diff options
author | leochanj105 <leochanj@live.unc.edu> | 2020-10-19 23:09:30 -0400 |
---|---|---|
committer | leochanj105 <leochanj@live.unc.edu> | 2020-10-20 02:40:39 -0400 |
commit | f618466c25d43f3bae9e40920273bf77de1e1149 (patch) | |
tree | 460e739e2165b8a9c37a9c7ab1b60f5874903543 /SD-VBS/common/toolbox/lagrcv/test.cc | |
parent | 47ced4e96bbb782b9e780e8f2cfc637b2c21ff44 (diff) |
initial sd-vbs
initial sd-vbs
add sd-vbs
sd-vbs
Diffstat (limited to 'SD-VBS/common/toolbox/lagrcv/test.cc')
-rwxr-xr-x | SD-VBS/common/toolbox/lagrcv/test.cc | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/SD-VBS/common/toolbox/lagrcv/test.cc b/SD-VBS/common/toolbox/lagrcv/test.cc new file mode 100755 index 0000000..d18144c --- /dev/null +++ b/SD-VBS/common/toolbox/lagrcv/test.cc | |||
@@ -0,0 +1,34 @@ | |||
1 | |||
2 | /* compile with | ||
3 | mex goodFeaturesToTrack.cc -I/usr/local/opencv/include -L/usr/local/opencv/lib -lcxcore -lcv | ||
4 | mex test.cc -L/home/ikkjin/LagrMatlab/opencv/matlab -llagrcv -I/home/ikkjin/LagrMatlab/opencv/matlab/ | ||
5 | */ | ||
6 | |||
7 | #include "mex.h" | ||
8 | #include "lagrcv.h" | ||
9 | #include <stdio.h> | ||
10 | #include <math.h> | ||
11 | |||
12 | #define MAX_CORNERS 500 | ||
13 | #define MAX_SIZE 700 | ||
14 | |||
15 | // TODO: add number of corners parameter | ||
16 | void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { | ||
17 | // usage: [ features numvalid ] = | ||
18 | // goodFeaturesToTrack(image, quality, mindist, mask) | ||
19 | // image must be single-channel, 8-bit | ||
20 | // quality = minimum acceptable ratio of eigenvalues | ||
21 | // mindist = minimum distance between corners | ||
22 | // mask (optional) = bitmap mask "region of interest" (MUST BE uint8 TYPE!) | ||
23 | |||
24 | char *image = (char*)mxGetPr(prhs[0]); | ||
25 | char *sum; | ||
26 | // int imdims[] = { (int)d_imdims[0], (int)d_imdims[1] }; | ||
27 | const int *imdims = mxGetDimensions(prhs[0]); | ||
28 | |||
29 | plhs[0] = mxCreateNumericMatrix(imdims[0], imdims[1], mxINT8_CLASS, mxREAL); | ||
30 | |||
31 | sum = (char*)mxGetPr(plhs[0]); | ||
32 | |||
33 | calcAreaSum(image, imdims[0], imdims[1], 8, sum); | ||
34 | } | ||