From 53ddbeb8c94cd71d37064d6d7e8ac56fef7ae5af Mon Sep 17 00:00:00 2001 From: siddhu8990 Date: Mon, 29 Aug 2016 10:47:52 +0530 Subject: OpenCV interface changed from c to c++ --- .../c/imageProcessing/cvcore/imcvCreateImages.cpp | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 2.3-1/src/c/imageProcessing/cvcore/imcvCreateImages.cpp (limited to '2.3-1/src/c/imageProcessing/cvcore/imcvCreateImages.cpp') diff --git a/2.3-1/src/c/imageProcessing/cvcore/imcvCreateImages.cpp b/2.3-1/src/c/imageProcessing/cvcore/imcvCreateImages.cpp new file mode 100644 index 00000000..a04e836a --- /dev/null +++ b/2.3-1/src/c/imageProcessing/cvcore/imcvCreateImages.cpp @@ -0,0 +1,46 @@ +/* Copyright (C) 2016 - IIT Bombay - FOSSEE + + This file must be used under the terms of the CeCILL. + This source file is licensed as described in the file COPYING, which + you should have received as part of this distribution. The terms + are also available at + http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + Author: Siddhesh Wani + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in +*/ + +/* Function to create openCV image object from given specifications*/ + +#include "types.h" +#include "cvcore.hpp" +#include + +using namespace cv; +using namespace std; + +Mat imcvCreateImages(int width, int height, char *bit_depth, uint8 no_of_ch) +{ + Mat img; + /*Create opencv matrix with given type*/ + if (strcmp(bit_depth,"CV_8U") == 0) + img = Mat(height,width,CV_8U); + else if (strcmp(bit_depth,"CV_8S") == 0) + img = Mat(height,width,CV_8S); + else if (strcmp(bit_depth,"CV_16U") == 0) + img = Mat(height,width,CV_16U); + else if (strcmp(bit_depth,"CV_16S") == 0) + img = Mat(height,width,CV_16S); + else if (strcmp(bit_depth,"CV_32F") == 0) + img = Mat(height,width,CV_32F); + else if (strcmp(bit_depth,"CV_32S") == 0) + img = Mat(height,width,CV_32S); + else if (strcmp(bit_depth,"CV_64F") == 0) + img = Mat(height,width,CV_64F); + + + /*Change no of channels to specified input*/ + img.reshape(no_of_ch); + + return img; +} \ No newline at end of file -- cgit