From a6df67e8bcd5159cde27556f4f6a315f8dc2215f Mon Sep 17 00:00:00 2001 From: shamikam Date: Mon, 16 Jan 2017 02:56:17 +0530 Subject: First Commit --- sci_gateway1/cpp/opencv_erode.cpp | 117 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 sci_gateway1/cpp/opencv_erode.cpp (limited to 'sci_gateway1/cpp/opencv_erode.cpp') diff --git a/sci_gateway1/cpp/opencv_erode.cpp b/sci_gateway1/cpp/opencv_erode.cpp new file mode 100644 index 0000000..fd12082 --- /dev/null +++ b/sci_gateway1/cpp/opencv_erode.cpp @@ -0,0 +1,117 @@ +#include +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/opencv.hpp" +#include +#include +using namespace cv; +using namespace std; +extern "C" +{ + #include "api_scilab.h" + #include "Scierror.h" + #include "BOOL.h" + #include + #include + #include "../common.h" + + int opencv_erode(char *fname, unsigned long fname_len) + { + + SciErr sciErr; + int intErr = 0; + int iRows=0,iCols=0; + int *piLen = NULL; + int *piAddr = NULL; + int *piAddrNew = NULL; + int *piAddr2 = NULL; + int *piAddr3 = NULL; + int *piAddr4 = NULL; + int *piAddr5 = NULL; + char **type = NULL; + int i,j,k; + double anchorX,anchorY,iterations; + double *kernel; + + //checking input argument + CheckInputArgument(pvApiCtx, 5, 5); + CheckOutputArgument(pvApiCtx, 1, 1) ; + + Mat image; + retrieveImage(image,1); + + //for kernel + sciErr = getVarAddressFromPosition(pvApiCtx,2,&piAddr2); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = getMatrixOfDouble(pvApiCtx, piAddr2, &iRows, &iCols, &kernel); + if(sciErr.iErr) + { + printError(&sciErr,0); + return 0; + } + + double actualkernel[iRows][iCols]; + for(i=0;i