diff options
Diffstat (limited to 'SD-VBS/common/toolbox/lagrcv/calcTexturePyrMex.cc')
-rwxr-xr-x | SD-VBS/common/toolbox/lagrcv/calcTexturePyrMex.cc | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/SD-VBS/common/toolbox/lagrcv/calcTexturePyrMex.cc b/SD-VBS/common/toolbox/lagrcv/calcTexturePyrMex.cc new file mode 100755 index 0000000..3c332ca --- /dev/null +++ b/SD-VBS/common/toolbox/lagrcv/calcTexturePyrMex.cc | |||
@@ -0,0 +1,54 @@ | |||
1 | |||
2 | /* compile with | ||
3 | rm liblagrcv.a | ||
4 | gcc -c lagrcv.cpp | ||
5 | ar rc liblagrcv.a lagrcv.o | ||
6 | ranlib liblagrcv.a | ||
7 | mex7 calcTextureMex.cc -L/home/ikkjin/LagrMatlab/opencv/matlab -llagrcv -I/home/ikkjin/LagrMatlab/opencv/matlab/ | ||
8 | */ | ||
9 | |||
10 | #include "mex.h" | ||
11 | #include "lagrcv.h" | ||
12 | #include <stdio.h> | ||
13 | #include <math.h> | ||
14 | |||
15 | // TODO: add number of corners parameter | ||
16 | void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { | ||
17 | // usage: [ lambda tr det c_xx c_xy c_yy] = | ||
18 | // calcTexturePyrMex(dxPyr, dyPyr, winSize, level) | ||
19 | // image is assumed to be double | ||
20 | // the lowest level is 1 | ||
21 | |||
22 | const int *cellDims = mxGetDimensions(prhs[0]); | ||
23 | int level=0; | ||
24 | char winSize = (char )mxGetScalar(prhs[2]); | ||
25 | double *dx, *dy; | ||
26 | const mxArray* dxArray, * dyArray; | ||
27 | const int *imdims; | ||
28 | double *tr, *det, *lambda, *c_xx, *c_xy, *c_yy; | ||
29 | |||
30 | if (nrhs > 3) level = (int)mxGetScalar(prhs[3])-1; | ||
31 | |||
32 | dxArray= mxGetCell(prhs[0],level); | ||
33 | dyArray= mxGetCell(prhs[1],level); | ||
34 | dx=mxGetPr(dxArray); | ||
35 | dy=mxGetPr(dyArray); | ||
36 | imdims = mxGetDimensions(dxArray); | ||
37 | |||
38 | plhs[0] = mxCreateNumericMatrix(imdims[0], imdims[1], mxDOUBLE_CLASS, mxREAL); | ||
39 | plhs[1] = mxCreateNumericMatrix(imdims[0], imdims[1], mxDOUBLE_CLASS, mxREAL); | ||
40 | plhs[2] = mxCreateNumericMatrix(imdims[0], imdims[1], mxDOUBLE_CLASS, mxREAL); | ||
41 | plhs[3] = mxCreateNumericMatrix(imdims[0], imdims[1], mxDOUBLE_CLASS, mxREAL); | ||
42 | plhs[4] = mxCreateNumericMatrix(imdims[0], imdims[1], mxDOUBLE_CLASS, mxREAL); | ||
43 | plhs[5] = mxCreateNumericMatrix(imdims[0], imdims[1], mxDOUBLE_CLASS, mxREAL); | ||
44 | |||
45 | lambda = (double*)mxGetPr(plhs[0]); | ||
46 | tr = (double*)mxGetPr(plhs[1]); | ||
47 | det = (double*)mxGetPr(plhs[2]); | ||
48 | c_xx = (double*)mxGetPr(plhs[3]); | ||
49 | c_xy = (double*)mxGetPr(plhs[4]); | ||
50 | c_yy = (double*)mxGetPr(plhs[5]); | ||
51 | |||
52 | calcGoodFeature(dx, dy, imdims[0], imdims[1], winSize, lambda, tr, det, c_xx, c_xy, c_yy); | ||
53 | |||
54 | } | ||