diff options
| author | Leo Chan <leochanj@live.unc.edu> | 2020-10-22 01:53:21 -0400 |
|---|---|---|
| committer | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-22 01:56:35 -0400 |
| commit | d17b33131c14864bd1eae275f49a3f148e21cf29 (patch) | |
| tree | 0d8f77922e8d193cb0f6edab83018f057aad64a0 /SD-VBS/common/toolbox/lagrcv/calcSobelMex.cc | |
| parent | 601ed25a4c5b66cb75315832c15613a727db2c26 (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/calcSobelMex.cc')
| -rwxr-xr-x | SD-VBS/common/toolbox/lagrcv/calcSobelMex.cc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/SD-VBS/common/toolbox/lagrcv/calcSobelMex.cc b/SD-VBS/common/toolbox/lagrcv/calcSobelMex.cc new file mode 100755 index 0000000..8667ec4 --- /dev/null +++ b/SD-VBS/common/toolbox/lagrcv/calcSobelMex.cc | |||
| @@ -0,0 +1,32 @@ | |||
| 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: [dx dy] = | ||
| 18 | // calcSobelMex(image) | ||
| 19 | |||
| 20 | double *image, *dx, *dy; | ||
| 21 | const int *imdims; | ||
| 22 | |||
| 23 | image=(double*)mxGetPr(prhs[0]); | ||
| 24 | imdims = mxGetDimensions(prhs[0]); | ||
| 25 | |||
| 26 | plhs[0] = mxCreateNumericMatrix(imdims[0], imdims[1], mxDOUBLE_CLASS, mxREAL); | ||
| 27 | plhs[1] = mxCreateNumericMatrix(imdims[0], imdims[1], mxDOUBLE_CLASS, mxREAL); | ||
| 28 | dx=(double*)mxGetPr(plhs[0]); | ||
| 29 | dy=(double*)mxGetPr(plhs[1]); | ||
| 30 | |||
| 31 | calcSobel(image, imdims[0], imdims[1], dx, dy); | ||
| 32 | } | ||
