summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/toolbox/lagrcv/calcSobelPyrMex.cc
diff options
context:
space:
mode:
authorLeo Chan <leochanj@live.unc.edu>2020-10-22 01:53:21 -0400
committerJoshua Bakita <jbakita@cs.unc.edu>2020-10-22 01:56:35 -0400
commitd17b33131c14864bd1eae275f49a3f148e21cf29 (patch)
tree0d8f77922e8d193cb0f6edab83018f057aad64a0 /SD-VBS/common/toolbox/lagrcv/calcSobelPyrMex.cc
parent601ed25a4c5b66cb75315832c15613a727db2c26 (diff)
Squashed commit of the sb-vbs branch.
Includes the SD-VBS benchmarks modified to: - Use libextra to loop as realtime jobs - Preallocate memory before starting their main computation - Accept input via stdin instead of via argc Does not include the SD-VBS matlab code. Fixes libextra execution in LITMUS^RT.
Diffstat (limited to 'SD-VBS/common/toolbox/lagrcv/calcSobelPyrMex.cc')
-rwxr-xr-xSD-VBS/common/toolbox/lagrcv/calcSobelPyrMex.cc44
1 files changed, 44 insertions, 0 deletions
diff --git a/SD-VBS/common/toolbox/lagrcv/calcSobelPyrMex.cc b/SD-VBS/common/toolbox/lagrcv/calcSobelPyrMex.cc
new file mode 100755
index 0000000..314c835
--- /dev/null
+++ b/SD-VBS/common/toolbox/lagrcv/calcSobelPyrMex.cc
@@ -0,0 +1,44 @@
1
2/* compile with
3rm liblagrcv.a
4gcc -c lagrcv.cpp
5ar rc liblagrcv.a lagrcv.o
6ranlib liblagrcv.a
7mex7 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
16void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
17 // usage: [dxPye dyPyr] =
18 // calcGradientPyrMex(imagePyr)
19
20 const int *cellDims = mxGetDimensions(prhs[0]);
21 double *image;
22 const mxArray* imgArray;
23 mxArray *dxArray, *dyArray;
24 double *dx, *dy;
25 const int *imdims;
26
27 plhs[0] = mxCreateCellArray(2, cellDims);
28 plhs[1] = mxCreateCellArray(2, cellDims);
29
30 for(int i=0; i<cellDims[0];i++){
31 imgArray= mxGetCell(prhs[0],i);
32 image=mxGetPr(imgArray);
33 imdims = mxGetDimensions(imgArray);
34
35 dxArray = mxCreateNumericMatrix(imdims[0], imdims[1], mxDOUBLE_CLASS, mxREAL);
36 dyArray = mxCreateNumericMatrix(imdims[0], imdims[1], mxDOUBLE_CLASS, mxREAL);
37 mxSetCell(plhs[0], i, dxArray);
38 mxSetCell(plhs[1], i, dyArray);
39 dx=mxGetPr(dxArray);
40 dy=mxGetPr(dyArray);
41
42 calcSobel(image, imdims[0], imdims[1], dx, dy);
43 }
44}