summaryrefslogtreecommitdiff
path: root/src/c/imageProcessing/cvcore
diff options
context:
space:
mode:
authorsiddhu89902016-08-29 10:47:52 +0530
committersiddhu89902016-08-29 10:47:52 +0530
commit2790257d385a9d7d9e0dab9205baf4b3df0dd8c8 (patch)
tree6a4ab6f09c9308bb1bf39e087b5d3b24d242519a /src/c/imageProcessing/cvcore
parentea1e22e36a9559448919d7ae2dd24a25743861ec (diff)
downloadScilab2C_fossee_old-2790257d385a9d7d9e0dab9205baf4b3df0dd8c8.tar.gz
Scilab2C_fossee_old-2790257d385a9d7d9e0dab9205baf4b3df0dd8c8.tar.bz2
Scilab2C_fossee_old-2790257d385a9d7d9e0dab9205baf4b3df0dd8c8.zip
OpenCV interface changed from c to c++
Diffstat (limited to 'src/c/imageProcessing/cvcore')
-rw-r--r--src/c/imageProcessing/cvcore/imcvCreateImages.c39
-rw-r--r--src/c/imageProcessing/cvcore/imcvCreateImages.cpp46
-rw-r--r--src/c/imageProcessing/cvcore/imcvGetImgSizes.cpp (renamed from src/c/imageProcessing/cvcore/imcvGetImgSizes.c)21
3 files changed, 54 insertions, 52 deletions
diff --git a/src/c/imageProcessing/cvcore/imcvCreateImages.c b/src/c/imageProcessing/cvcore/imcvCreateImages.c
deleted file mode 100644
index 4543b72..0000000
--- a/src/c/imageProcessing/cvcore/imcvCreateImages.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* 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.h"
-#include <stdio.h>
-
-IplImage* imcvCreateImages(int width, int height, char *bit_depth, uint8 no_of_ch)
-{
- CvSize imageSize = cvSize (width,height);
- IplImage* img = NULL;
- if (strcmp(bit_depth,"IPL_DEPTH_1U") == 0)
- img = cvCreateImage(imageSize,IPL_DEPTH_1U,no_of_ch);
- else if (strcmp(bit_depth,"IPL_DEPTH_8U") == 0)
- img = cvCreateImage(imageSize,IPL_DEPTH_8U,no_of_ch);
- else if (strcmp(bit_depth,"IPL_DEPTH_8S") == 0)
- img = cvCreateImage(imageSize,IPL_DEPTH_8S,no_of_ch);
- else if (strcmp(bit_depth,"IPL_DEPTH_16U") == 0)
- img = cvCreateImage(imageSize,IPL_DEPTH_8U,no_of_ch);
- else if (strcmp(bit_depth,"IPL_DEPTH_16S") == 0)
- img = cvCreateImage(imageSize,IPL_DEPTH_8S,no_of_ch);
- else if (strcmp(bit_depth,"IPL_DEPTH_32U") == 0)
- img = cvCreateImage(imageSize,IPL_DEPTH_8U,no_of_ch);
- else if (strcmp(bit_depth,"IPL_DEPTH_32S") == 0)
- img = cvCreateImage(imageSize,IPL_DEPTH_8S,no_of_ch);
-
- return img;
-} \ No newline at end of file
diff --git a/src/c/imageProcessing/cvcore/imcvCreateImages.cpp b/src/c/imageProcessing/cvcore/imcvCreateImages.cpp
new file mode 100644
index 0000000..a04e836
--- /dev/null
+++ b/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 <stdio.h>
+
+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
diff --git a/src/c/imageProcessing/cvcore/imcvGetImgSizes.c b/src/c/imageProcessing/cvcore/imcvGetImgSizes.cpp
index 2faa627..0c4e848 100644
--- a/src/c/imageProcessing/cvcore/imcvGetImgSizes.c
+++ b/src/c/imageProcessing/cvcore/imcvGetImgSizes.cpp
@@ -13,20 +13,15 @@
/* Function to convert image object to other color space*/
#include "types.h"
-#include "cvcore.h"
-#include "cvimgproc.h"
+#include "cvcore.hpp"
+#include "cvimgproc.hpp"
#include <stdio.h>
-void imcvGetImgSizes(IplImage* src, double* imgsize)
+using namespace cv;
+using namespace std;
+
+void imcvGetImgSizes(Mat src, double* imgsize)
{
- if(src != NULL)
- {
- imgsize[0] = src->width;
- imgsize[1] = src->height;
- }
- else
- {
- printf("Error with input image");
- }
-
+ imgsize[0] = src.rows;
+ imgsize[1] = src.cols;
} \ No newline at end of file