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_FFT.cpp | 89 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 sci_gateway1/cpp/opencv_FFT.cpp (limited to 'sci_gateway1/cpp/opencv_FFT.cpp') diff --git a/sci_gateway1/cpp/opencv_FFT.cpp b/sci_gateway1/cpp/opencv_FFT.cpp new file mode 100644 index 0000000..1ac386e --- /dev/null +++ b/sci_gateway1/cpp/opencv_FFT.cpp @@ -0,0 +1,89 @@ +/**************************************** +Author: Sridhar Reddy +*****************************************/ +#include +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/opencv.hpp" +#include +using namespace cv; +using namespace std; +extern "C" +{ + #include "api_scilab.h" + #include "Scierror.h" + #include "BOOL.h" + #include + #include "sciprint.h" + #include "../common.h" + + int opencv_fftnew(char *fname, unsigned long fname_len) + { + SciErr sciErr; + int intErr=0; + int iRows=0,iCols=0,i,j; + int *piAddr1=NULL; + double *ipReal=NULL; + double *ipImg=NULL; + double *rsltReal=NULL; + double *rsltImg=NULL; + vector > vec_out; + vector vec_in; + + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 1, 1) ; + + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = getMatrixOfDouble(pvApiCtx, piAddr1, &iRows, &iCols, &ipReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + ipImg = (double*)malloc(sizeof(double) * iRows * iCols); + if(iRows==1){ + for(i = 0 ; i