This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Fast non-maximum suppression in C, port from | |
| * http://quantombone.blogspot.com/2011/08/blazing-fast-nmsm-from-exemplar-svm.html | |
| * | |
| * @blackball (bugway@gmail.com) | |
| */ | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <limits.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 0.有时候,我们需要在两个不同的值之间切换,类似于开关。普遍的做法是: | |
| if (t == value0) { | |
| t = value1; | |
| } else { | |
| t = value0; | |
| } | |
| // 条件分支是一个开销相对较大的操作,所以,另外一种高效的做法是: | |
| t = value0 + value1 - t; | |
| // 为了避免value0或者value1值都较大,可以加上一括号: | |
| t = value0 + (value1 - t); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * well, I feel it's annoying to configure gsl everytime | |
| * for PF tracking, so, I made a new one according to gsl.:) | |
| * @author blackball @date Feb.12.2011 | |
| * @todo this filename is worng, change it to gsl_rng_dist.h | |
| */ | |
| #ifndef _GSL_RNG_MT_H_ | |
| #define _GSL_RNG_MT_H_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Definition of ...MT random number generator | |
| * @author blackball @date Feb.12.2011 | |
| **/ | |
| #include "gsl_rng_mt.h" | |
| #include <malloc.h> | |
| #include <math.h> | |
| #define N 624 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Binary search tree, a C implementation. | |
| * | |
| * I hope it could be a bit more efficient ;) | |
| * | |
| * @blackball | |
| */ | |
| #include <stdlib.h> | |
| /* for futher use */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Simple linked-list demo */ | |
| typedef struct node{ | |
| void *data; | |
| struct node *next; | |
| struct node *prev; | |
| } node; | |
| node* create(node **ns, void *data); | |
| node* search(node **ns, void *data); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "vpack.h" | |
| #include <stdio.h> | |
| struct Model | |
| { | |
| char c; | |
| int pts[4]; | |
| float vec[1024]; | |
| }; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| """ | |
| Simulate a command pipe in windows. | |
| reason: I always need to do batch processing | |
| in my dailylife, rename a bunch of files, | |
| generate some sets from it, and move files | |
| into different folders. Or, I have a module, | |
| and I need to processing lots of file, but, | |
| this module can only process one at most, and I |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //----------.h file ------------ | |
| #ifndef MYVIDEOWIDGET_H | |
| #define MYVIDEOWIDGET_H | |
| #include <QtOpenGL/QtOpenGL> | |
| #include <QtGui/QImage> | |
| class MyVideoWidget : public QGLWidget | |
| { | |
| Q_OBJECT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int pack_arr(struct db *dbase, void *data, int len) | |
| { | |
| int code = -1; | |
| struct db_node *node = new_node(len); | |
| memcpy(node->data, data, len); | |
| // insert node into dbase | |
| dump(dbase, node); | |
| code = 0; |