Skip to content

Instantly share code, notes, and snippets.

View jiyeqian's full-sized avatar

Jiye Qian jiyeqian

View GitHub Profile
2015-08-12 22:13:36 +0800
./configure
--prefix=/usr/local/Cellar/r/3.2.1_1
--with-libintl-prefix=/usr/local/opt/gettext
--enable-memory-profiling
--enable-R-framework
--with-cairo
--with-aqua
--with-blas=-L/usr/local/opt/openblas/lib -lopenblas
/*
修改积分图的计算逻辑,可以更有利于并行化:
1. 行积分图:先按行从左至右计算“原图”每行的积分图;
2. 列积分图:再按列从上至下计算“行积分图”每列的积分图,即为所求积分图。
计算结果与OpenCV一致,_src为CV_8UC1,_sum为_CV_32SC1。
*/
void parallel_integral(CvMat *_src, CvMat *_sum)
{
// OpenCV: utility.hpp
template<typename _Tp, size_t fixed_size = 1024/sizeof(_Tp)+8> class AutoBuffer
{
public:
typedef _Tp value_type;
//! the default constructor
AutoBuffer();
//! constructor taking the real buffer size
// OpenCV: sumpixels.cpp
template<typename T, typename ST, typename QT>
void integral_( const T* src, size_t _srcstep, ST* sum, size_t _sumstep,
QT* sqsum, size_t _sqsumstep, ST* tilted, size_t _tiltedstep,
Size size, int cn )
{
int x, y, k;
int srcstep = (int)(_srcstep/sizeof(T));
// http://tinyhack.com/2014/03/12/implementing-a-web-server-in-a-single-printf-call/
// http://blog.jobbole.com/64252/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<sys/socket.h>
@jiyeqian
jiyeqian / x265_log.cpp
Last active August 29, 2015 13:59
x265_log
/* Log level */
#define X265_LOG_NONE (-1)
#define X265_LOG_ERROR 0
#define X265_LOG_WARNING 1
#define X265_LOG_INFO 2
#define X265_LOG_DEBUG 3
#define X265_LOG_FULL 4
@jiyeqian
jiyeqian / quick.c
Last active January 1, 2016 14:29
Sort Algorithms
void QuickSort(int *seq, const int begin, const int end)
{
if (begin < end) {
int position = begin; // 选择起始元素作为划分参考
int value = seq[position];
for (int i = begin + 1; i < end; ++i) {
if (seq[i] < value) {
position++;
if (position != i) {
Swap(&seq[position], &seq[i]);
@jiyeqian
jiyeqian / url_hander.py
Created July 25, 2013 05:50
handle urls of weepy
# http://fighter1945.iteye.com/blog/1347732
import web
from web import form as form
urls = (
'/add/me/(.+)','add',
'/myadd','myadd'
)
class add:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "queue.h"
typedef struct Node {
void *element;
LIST_ENTRY ( Node ) linker;
@jiyeqian
jiyeqian / opencv_data_structure.c
Last active December 15, 2015 13:58
basic data structures of OpenCV
#define IPL_DEPTH_1U 1 // 1位无符号整型(1bit)
#define IPL_DEPTH_8U 8 // 8位无符号整型(unsigned char)
#define IPL_DEPTH_16U 16 // 16位无符号整型
#define IPL_DEPTH_32F 32 // 32位浮點
#define IPL_DEPTH_8S (IPL_DEPTH_SIGN| 8)
#define IPL_DEPTH_16S (IPL_DEPTH_SIGN|16)
#define IPL_DEPTH_32S (IPL_DEPTH_SIGN|32)
typedef struct _IplImage