From d17b33131c14864bd1eae275f49a3f148e21cf29 Mon Sep 17 00:00:00 2001 From: Leo Chan Date: Thu, 22 Oct 2020 01:53:21 -0400 Subject: 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. --- SD-VBS/common/toolbox/lagrcv/dummyMex.cc | 58 ++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 SD-VBS/common/toolbox/lagrcv/dummyMex.cc (limited to 'SD-VBS/common/toolbox/lagrcv/dummyMex.cc') diff --git a/SD-VBS/common/toolbox/lagrcv/dummyMex.cc b/SD-VBS/common/toolbox/lagrcv/dummyMex.cc new file mode 100755 index 0000000..0799182 --- /dev/null +++ b/SD-VBS/common/toolbox/lagrcv/dummyMex.cc @@ -0,0 +1,58 @@ + +/* compile with +rm liblagrcv.a +gcc -c lagrcv.cpp +ar rc liblagrcv.a lagrcv.o +ranlib liblagrcv.a +mex7 calcTextureMex.cc -L/home/ikkjin/LagrMatlab/opencv/matlab -llagrcv -I/home/ikkjin/LagrMatlab/opencv/matlab/ +*/ + +#include "mex.h" +#include "lagrcv.h" +#include +#include + +// TODO: add number of corners parameter +void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { + // usage: [newFeaturePnt validFlag ] = + // calcOptFlowPyrLKMex(Ipyr, IdxPyr, IdyPyr, Jpyr, featurePnt, winSize, c_level, c_det, c_xx, c_xy, c_yy) + // Ipyr, IdxPyr, IdyPyr, Jpyr: levelx1 size cell. + // featurePnt 2xn int + // winSize c_level int + // c_xx c_xy c_yy: image size double* + // image must be single-channel, 8-bit + + + double* fPntDouble; + const int *nFeatures; + char* valid; + int *fPnt, *newFPnt; + + fPntDouble=(double*)mxGetPr(prhs[0]); + nFeatures=mxGetDimensions(prhs[0]); + fPnt=(int*)malloc(sizeof(int)*nFeatures[0]*nFeatures[1]); + + printf("nFeatures %d, %d", nFeatures[0], nFeatures[1]); + //plhs[0] = mxCreateNumericMatrix(nFeatures[0], nFeatures[1], mxINT32_CLASS, mxREAL); + plhs[0] = mxCreateNumericArray(2,nFeatures,mxINT32_CLASS, mxREAL); + //plhs[1] = mxCreateNumericMatrix(1, nFeatures[1], mxINT32_CLASS, mxREAL); + plhs[1] = mxCreateNumericArray(1,nFeatures+1,mxUINT8_CLASS, mxREAL); + + newFPnt = (int*)mxGetPr(plhs[0]); + valid = (char*)mxGetPr(plhs[1]); + + //idx convert from matlab to c + for(int i=0; i