/* ==================================================================== */ /* Author :Priyanka Hiranandani NIT Surat */ /* ==================================================================== */ /* Syntax : return_doublevalue=arcLength(InputArray curve, bool closed) */ /* ==================================================================== */ #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 arclenght(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; char **pstData2 = NULL; double *rrows; double *rcols; unsigned char *pstDataR = NULL; unsigned char *pstDataG = NULL; unsigned char *pstDataB = NULL; int noofitem; double res; double *epsilon; int error; //checking input argument CheckInputArgument(pvApiCtx,2,2); //checking output argument CheckOutputArgument(pvApiCtx, 1, 1); //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