Skip to content

Instantly share code, notes, and snippets.

@ifq
ifq / resize.go
Last active December 21, 2015 15:29
thumbnail generate, use vipsthumbnail cmdtool which comes from libvips. It takes 0.3s to generate a thumbnail from a 5Mbyte photo on one cpu core.
func ResizeImg(spath string, tpath []string, size []image.Point) (int, error) {
if len(tpath) != len(size) {
log.Println("GetImgThumb: ", tpath, size)
return 0, errors.New("GetImgThumb length unsafe")
}
cnt := 0
for i, tgt := range tpath {
log.Println("+++", spath, tgt)
_, err := os.Stat(tgt)
@ifq
ifq / resize.go
Created August 19, 2013 11:24
speed test for github.com/nfnt/resize.
package main
import (
"github.com/nfnt/resize"
"os"
"path/filepath"
"image"
"image/jpeg"
"log"
"errors"
@ifq
ifq / imageset.go
Last active December 20, 2015 20:39
测试下一个基本的结构体在Golang下的内存消耗情况
package main
// 为一个小项目做准备,测试下数据结构的内存消耗情况
// 初次接触Go语言,很多东西需要了解
// 下面的结构体,创建1,000,000各 imgobj 时的log:
// 2013/08/09 14:53:42 alloc:307904, heapAlloc:307904
// 2013/08/09 14:53:42 alloc:7469888, heapAlloc:7469888
// 2013/08/09 14:53:42 alloc:12406664, heapAlloc:12406664
// 2013/08/09 14:53:43 alloc:26354224, heapAlloc:26354224
// 2013/08/09 14:53:43 alloc:24996016, heapAlloc:24996016
@ifq
ifq / blogtrans.go
Created July 29, 2013 10:22
octopress 博客转 gor 用的小工具,go语言练手。。
package main
import (
"os"
"fmt"
"strings"
"io/ioutil"
"regexp"
"strconv"
)
@ifq
ifq / heart_200hz_2.txt
Created July 8, 2013 05:54
脉搏数据样本,被测对象11岁小孩,心跳93左右
0.2392578125
0.224609375
0.2197265625
0.21484375
0.2197265625
0.2001953125
0.205078125
0.1904296875
0.1904296875
0.1904296875
@ifq
ifq / cal-heart.c
Created July 5, 2013 10:59
脉搏电压测量程序改进版--实时反馈
/* [2013-07-06 六 12:18] IF.Q
* 脉搏检测
* */
#include <stdio.h>
#include <stdlib.h>
typedef int beatype;
@ifq
ifq / cal-heart.c
Created July 5, 2013 06:47
根据脉搏电压数据检测心跳的程序
/* ifqqfi在gmail.com
* [2013-07-05 五]
*
* 脉搏检测程序
*/
#include <stdio.h>
#include <stdlib.h>
@ifq
ifq / quick.org
Created May 6, 2013 09:25
如何去看gcc pre-compile 宏的方法。

echo | armeb-linux-gcc -dM -E - #define __DBL_MIN_EXP__ (-1021) #define __FLT_MIN__ 1.17549435e-38F #define __DEC64_DEN__ 0.000000000000001E-383DD #define __CHAR_BIT__ 8 #define __WCHAR_MAX__ 4294967295U #define __DBL_DENORM_MIN__ 4.9406564584124654e-324 #define __FLT_EVAL_METHOD__ 0 #define __unix__ 1 #define __DBL_MIN_10_EXP__ (-307)

@ifq
ifq / reco_sym.cpp
Created May 6, 2013 06:22
opencv example of branch-like sym reco.
/**
* @file reco_sym.cpp
* @brief this is a simple try for kin san's pj, which need to reco some
* symbol like tree branch shape.
* @author ifqqfi gmail
*
*/
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
@ifq
ifq / reco_sym.cpp
Created May 6, 2013 03:03
first try of gist.
// this is just a test
for( size_t i = 0; i < contours.size(); i++ ) {
approxPolyDP( Mat(contours[i]), contours_poly[i], 3, true );
boundRect[i] = boundingRect( Mat(contours_poly[i]) );
minEnclosingCircle( contours_poly[i], center[i], radius[i] );
}