/* ==================================================================== */ /* Author :Priyanka Hiranandani NIT Surat */ /* ==================================================================== */ /* Syntax : [a,b,c,e,f]=fitellipse((InputArray points); a,b,c,d,e are parameters of rotated rect returned /* ==================================================================== */ #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 "../common.h" int fitellipse(char *fname, unsigned long fname_len) { // Error management variable SciErr sciErr; //variable info int iRows = 0; int iCols = 0; int piRows = 0; int piCols = 0; int* piAddr = NULL; int* piAddr2 = NULL; int* piAddr3 = NULL; int* piAddr4 = NULL; int* piAddr5 = NULL; int* piAddr6 = NULL; int* piAddrNew = NULL; int* piLen = NULL; double* pstData = NULL; int* pstData2 = NULL; double *rrows; double *rcols; double sigmaSpace; int error; ////checking input argument CheckInputArgument(pvApiCtx,1,1); //checking output argument CheckOutputArgument(pvApiCtx,5,5); //for first argument // get Address of first input sciErr = getVarAddressFromPosition(pvApiCtx,1,&piAddr); //check for any error if(sciErr.iErr) { printError(&sciErr, 0); return 0; } //retrieve input array //SciErr getMatrixOfDouble(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, double** _pdblReal) sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols,&pstData); if(sciErr.iErr) { printError(&sciErr, 0); return 0; } int k=0; vector contours; for(int i=0;i