diff options
author | shamikam | 2017-01-16 02:56:17 +0530 |
---|---|---|
committer | shamikam | 2017-01-16 02:56:17 +0530 |
commit | a6df67e8bcd5159cde27556f4f6a315f8dc2215f (patch) | |
tree | e806e966b06a53388fb300d89534354b222c2cad /sci_gateway/cpp/rgb2gray.cpp~ | |
download | FOSSEE_Image_Processing_Toolbox-master.tar.gz FOSSEE_Image_Processing_Toolbox-master.tar.bz2 FOSSEE_Image_Processing_Toolbox-master.zip |
Diffstat (limited to 'sci_gateway/cpp/rgb2gray.cpp~')
-rw-r--r-- | sci_gateway/cpp/rgb2gray.cpp~ | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/sci_gateway/cpp/rgb2gray.cpp~ b/sci_gateway/cpp/rgb2gray.cpp~ new file mode 100644 index 0000000..c422638 --- /dev/null +++ b/sci_gateway/cpp/rgb2gray.cpp~ @@ -0,0 +1,46 @@ +/* ==================================================================== */ +/* Author :Priyanka Hiranandani NIT Surat */ +/* ==================================================================== */ +/* Syntax : return_image=rgb2gray(sourceimage) */ +/* ==================================================================== */ +#include <numeric> +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/opencv.hpp" +#include "opencv2/imgproc/imgproc.hpp" //new header file for cvtColor function of opencv +#include <iostream> +using namespace cv; +using namespace std; +extern "C" +{ +#include "api_scilab.h" +#include "Scierror.h" +#include "BOOL.h" +#include <localization.h> +#include<string.h> +#include "../common.h" +int rgb2gray(char *fname, unsigned long fname_len) +{ + + // Error management variable + SciErr sciErr; + //checking input argument + CheckInputArgument(pvApiCtx,1,1); + //checking output argument + CheckOutputArgument(pvApiCtx, 1, 1) + Mat img,grayimg; + //calling function + retrieveImage(img,1); + cvtColor(img, grayimg, CV_BGR2GRAY ); + string tempstring = type2str(grayimg.type()); + char* checker = (char *)malloc(tempstring.size() + 1); + memcpy(checker, tempstring.c_str(), tempstring.size() + 1); + returnImage(checker,grayimg,1); + //returning output variable + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + ReturnArguments(pvApiCtx); + return 0; +} + +/* ==================================================================== */ +} |