From c8fd6991786ccddb44547b619178bb391f3f9b96 Mon Sep 17 00:00:00 2001 From: siddhu8990 Date: Thu, 18 Aug 2016 15:47:18 +0530 Subject: RPi-PWM and basic imaage processing --- src/c/imageProcessing/cvcore/imcvCreateImages.c | 39 ++++++++++++++++++++++++ src/c/imageProcessing/cvhighgui/imcvLoadImages.c | 23 ++++++++++++++ src/c/imageProcessing/cvhighgui/imcvShowImages.c | 25 +++++++++++++++ src/c/imageProcessing/includes/core.h | 11 +++++++ src/c/imageProcessing/includes/cvcore.h | 30 ++++++++++++++++++ src/c/imageProcessing/includes/cvhighgui.h | 32 +++++++++++++++++++ src/c/imageProcessing/includes/temp.h | 11 +++++++ src/c/imageProcessing/interfaces/int_cvcore.h | 31 +++++++++++++++++++ src/c/imageProcessing/interfaces/int_cvhighgui.h | 34 +++++++++++++++++++++ 9 files changed, 236 insertions(+) create mode 100644 src/c/imageProcessing/cvcore/imcvCreateImages.c create mode 100644 src/c/imageProcessing/cvhighgui/imcvLoadImages.c create mode 100644 src/c/imageProcessing/cvhighgui/imcvShowImages.c create mode 100644 src/c/imageProcessing/includes/core.h create mode 100644 src/c/imageProcessing/includes/cvcore.h create mode 100644 src/c/imageProcessing/includes/cvhighgui.h create mode 100644 src/c/imageProcessing/includes/temp.h create mode 100644 src/c/imageProcessing/interfaces/int_cvcore.h create mode 100644 src/c/imageProcessing/interfaces/int_cvhighgui.h (limited to 'src/c/imageProcessing') diff --git a/src/c/imageProcessing/cvcore/imcvCreateImages.c b/src/c/imageProcessing/cvcore/imcvCreateImages.c new file mode 100644 index 00000000..a7eeaec2 --- /dev/null +++ b/src/c/imageProcessing/cvcore/imcvCreateImages.c @@ -0,0 +1,39 @@ +/* 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 + +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/cvhighgui/imcvLoadImages.c b/src/c/imageProcessing/cvhighgui/imcvLoadImages.c new file mode 100644 index 00000000..7c843f94 --- /dev/null +++ b/src/c/imageProcessing/cvhighgui/imcvLoadImages.c @@ -0,0 +1,23 @@ +/* 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 load image object from given filename*/ + +#include "types.h" +#include "cvcore.h" +#include "cvhighgui.h" +#include + +IplImage* imcvLoadImages(char *filename, uint8 opentype) +{ + return (cvLoadImage(filename,opentype)); +} \ No newline at end of file diff --git a/src/c/imageProcessing/cvhighgui/imcvShowImages.c b/src/c/imageProcessing/cvhighgui/imcvShowImages.c new file mode 100644 index 00000000..82ae3ee3 --- /dev/null +++ b/src/c/imageProcessing/cvhighgui/imcvShowImages.c @@ -0,0 +1,25 @@ +/* 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 show an image */ + +#include "types.h" +#include "cvcore.h" +#include "cvhighgui.h" +#include + +uint8 imcvShowImages(char *winname, IplImage* img) +{ + cvShowImage(winname,img); + + return (0); +} \ No newline at end of file diff --git a/src/c/imageProcessing/includes/core.h b/src/c/imageProcessing/includes/core.h new file mode 100644 index 00000000..1e4c83cb --- /dev/null +++ b/src/c/imageProcessing/includes/core.h @@ -0,0 +1,11 @@ + /* 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 + */ diff --git a/src/c/imageProcessing/includes/cvcore.h b/src/c/imageProcessing/includes/cvcore.h new file mode 100644 index 00000000..317d99b6 --- /dev/null +++ b/src/c/imageProcessing/includes/cvcore.h @@ -0,0 +1,30 @@ +/* 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 +*/ + +#ifndef __CVCORE_H__ +#define __CVCORE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "types.h" +#include "opencv2/core/core.hpp" + +IplImage* imcvCreateImages(int width, int height, char *bit_depth, uint8 no_of_ch); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__CVCORE_H__*/ diff --git a/src/c/imageProcessing/includes/cvhighgui.h b/src/c/imageProcessing/includes/cvhighgui.h new file mode 100644 index 00000000..cae3dd1b --- /dev/null +++ b/src/c/imageProcessing/includes/cvhighgui.h @@ -0,0 +1,32 @@ +/* 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 +*/ + +#ifndef __CVHIGHGUI_H__ +#define __CVHIGHGUI_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "types.h" +#include "opencv2/core/core.hpp" +#include "opencv2/highgui.hpp" + +IplImage* imcvLoadImages(char *filename, uint8 opentype); +uint8 imcvShowImages(char *winname, IplImage* img); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__CVCORE_H__*/ diff --git a/src/c/imageProcessing/includes/temp.h b/src/c/imageProcessing/includes/temp.h new file mode 100644 index 00000000..1e4c83cb --- /dev/null +++ b/src/c/imageProcessing/includes/temp.h @@ -0,0 +1,11 @@ + /* 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 + */ diff --git a/src/c/imageProcessing/interfaces/int_cvcore.h b/src/c/imageProcessing/interfaces/int_cvcore.h new file mode 100644 index 00000000..9d83caac --- /dev/null +++ b/src/c/imageProcessing/interfaces/int_cvcore.h @@ -0,0 +1,31 @@ +/* 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 +*/ + +#ifndef __INT_CVCORE_H__ +#define __INT_CVCORE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "types.h" + + +#define d0d0g2d0CV_CreateImageim0(width,height,depth,depth_size,no_of_ch) \ + imcvCreateImages(width,height,depth,no_of_ch) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_CVCORE_H__*/ diff --git a/src/c/imageProcessing/interfaces/int_cvhighgui.h b/src/c/imageProcessing/interfaces/int_cvhighgui.h new file mode 100644 index 00000000..f08ac40b --- /dev/null +++ b/src/c/imageProcessing/interfaces/int_cvhighgui.h @@ -0,0 +1,34 @@ +/* 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 +*/ + +#ifndef __INT_CVHIGHGUI_H__ +#define __INT_CVHIGHGUI_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "types.h" +#include "opencv2/highgui.hpp" + +#define g2d0CV_LoadImageim0(filename,name_size,loadtype) imcvLoadImages(filename,loadtype) +#define g2im0CV_ShowImageu80(winname,win_size,img) imcvShowImages(winname,img) +#define im0CV_ShowImageu80(img) imcvShowImages("",img) +#define d0CV_WaitKeyu80(delay) cvWaitKey(delay) +#define g2im0CV_SaveImageu80(filename,name_size,img) cvSaveImage(filename,img,NULL) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_CVHIGHGUI_H__*/ -- cgit From ea1e22e36a9559448919d7ae2dd24a25743861ec Mon Sep 17 00:00:00 2001 From: siddhu8990 Date: Thu, 25 Aug 2016 10:29:32 +0530 Subject: Basic image prcessing working for RPi --- src/c/imageProcessing/cvcore/imcvCreateImages.c | 2 +- src/c/imageProcessing/cvcore/imcvGetImgSizes.c | 32 ++++++++++++++++++++++++ src/c/imageProcessing/cvimgproc/imcvCvtColors.c | 27 ++++++++++++++++++++ src/c/imageProcessing/cvimgproc/imcvThresholds.c | 27 ++++++++++++++++++++ src/c/imageProcessing/includes/cvcore.h | 2 +- src/c/imageProcessing/includes/cvhighgui.h | 2 +- src/c/imageProcessing/includes/cvimgproc.h | 31 +++++++++++++++++++++++ src/c/imageProcessing/interfaces/int_cvcore.h | 3 ++- src/c/imageProcessing/interfaces/int_cvhighgui.h | 2 +- src/c/imageProcessing/interfaces/int_cvimgproc.h | 32 ++++++++++++++++++++++++ 10 files changed, 155 insertions(+), 5 deletions(-) create mode 100644 src/c/imageProcessing/cvcore/imcvGetImgSizes.c create mode 100644 src/c/imageProcessing/cvimgproc/imcvCvtColors.c create mode 100644 src/c/imageProcessing/cvimgproc/imcvThresholds.c create mode 100644 src/c/imageProcessing/includes/cvimgproc.h create mode 100644 src/c/imageProcessing/interfaces/int_cvimgproc.h (limited to 'src/c/imageProcessing') diff --git a/src/c/imageProcessing/cvcore/imcvCreateImages.c b/src/c/imageProcessing/cvcore/imcvCreateImages.c index a7eeaec2..4543b724 100644 --- a/src/c/imageProcessing/cvcore/imcvCreateImages.c +++ b/src/c/imageProcessing/cvcore/imcvCreateImages.c @@ -19,7 +19,7 @@ IplImage* imcvCreateImages(int width, int height, char *bit_depth, uint8 no_of_ch) { CvSize imageSize = cvSize (width,height); - IplImage *img = NULL; + 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) diff --git a/src/c/imageProcessing/cvcore/imcvGetImgSizes.c b/src/c/imageProcessing/cvcore/imcvGetImgSizes.c new file mode 100644 index 00000000..2faa6271 --- /dev/null +++ b/src/c/imageProcessing/cvcore/imcvGetImgSizes.c @@ -0,0 +1,32 @@ +/* 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 convert image object to other color space*/ + +#include "types.h" +#include "cvcore.h" +#include "cvimgproc.h" +#include + +void imcvGetImgSizes(IplImage* src, double* imgsize) +{ + if(src != NULL) + { + imgsize[0] = src->width; + imgsize[1] = src->height; + } + else + { + printf("Error with input image"); + } + +} \ No newline at end of file diff --git a/src/c/imageProcessing/cvimgproc/imcvCvtColors.c b/src/c/imageProcessing/cvimgproc/imcvCvtColors.c new file mode 100644 index 00000000..bc2a70ec --- /dev/null +++ b/src/c/imageProcessing/cvimgproc/imcvCvtColors.c @@ -0,0 +1,27 @@ +/* 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 convert image object to other color space*/ + +#include "types.h" +#include "cvcore.h" +#include "cvimgproc.h" +#include + +uint8 imcvCvtColors(IplImage* src, IplImage* dst, char* code) +{ + + if(strcmp(code,"CV_BGR2GRAY") == 0) + cvCvtColor(src,dst,CV_RGB2GRAY); + + return 0; +} \ No newline at end of file diff --git a/src/c/imageProcessing/cvimgproc/imcvThresholds.c b/src/c/imageProcessing/cvimgproc/imcvThresholds.c new file mode 100644 index 00000000..cd66c52e --- /dev/null +++ b/src/c/imageProcessing/cvimgproc/imcvThresholds.c @@ -0,0 +1,27 @@ +/* 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 threshold a gray scale image*/ + +#include "types.h" +#include "cvcore.h" +#include "cvimgproc.h" +#include + +IplImage* imcvThresholds(IplImage* src, double threshold, double maxvalue, char* type) +{ + dst = imcvCreates(src->width, src->height, src->,1); + if(strcmp(code,"CV_BGR2GRAY") == 0) + cvCvtColor(src,dst,CV_RGB2GRAY); + + return 0; +} \ No newline at end of file diff --git a/src/c/imageProcessing/includes/cvcore.h b/src/c/imageProcessing/includes/cvcore.h index 317d99b6..4f04e581 100644 --- a/src/c/imageProcessing/includes/cvcore.h +++ b/src/c/imageProcessing/includes/cvcore.h @@ -22,7 +22,7 @@ extern "C" { #include "opencv2/core/core.hpp" IplImage* imcvCreateImages(int width, int height, char *bit_depth, uint8 no_of_ch); - +void imcvGetImgSizes(IplImage* src, double* imgsize); #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/imageProcessing/includes/cvhighgui.h b/src/c/imageProcessing/includes/cvhighgui.h index cae3dd1b..2e959a5d 100644 --- a/src/c/imageProcessing/includes/cvhighgui.h +++ b/src/c/imageProcessing/includes/cvhighgui.h @@ -20,7 +20,7 @@ extern "C" { #include "types.h" #include "opencv2/core/core.hpp" -#include "opencv2/highgui.hpp" +#include "opencv2/highgui/highgui.hpp" IplImage* imcvLoadImages(char *filename, uint8 opentype); uint8 imcvShowImages(char *winname, IplImage* img); diff --git a/src/c/imageProcessing/includes/cvimgproc.h b/src/c/imageProcessing/includes/cvimgproc.h new file mode 100644 index 00000000..5d982e49 --- /dev/null +++ b/src/c/imageProcessing/includes/cvimgproc.h @@ -0,0 +1,31 @@ +/* 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 +*/ + +#ifndef __CVIMGPROC_H__ +#define __CVIMGPROC_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "types.h" +#include "opencv2/core/core.hpp" +#include "opencv2/imgproc/imgproc.hpp" + +uint8 imcvCvtColor(IplImage* src, IplImage* dst, char* code); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__CVIMGPROC_H__*/ diff --git a/src/c/imageProcessing/interfaces/int_cvcore.h b/src/c/imageProcessing/interfaces/int_cvcore.h index 9d83caac..5ae0055f 100644 --- a/src/c/imageProcessing/interfaces/int_cvcore.h +++ b/src/c/imageProcessing/interfaces/int_cvcore.h @@ -19,11 +19,12 @@ extern "C" { #include "types.h" - +#include "cvcore.h" #define d0d0g2d0CV_CreateImageim0(width,height,depth,depth_size,no_of_ch) \ imcvCreateImages(width,height,depth,no_of_ch) +#define im0CV_GetImgSized2(img,imgsize) imcvGetImgSizes(img,imgsize) #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/imageProcessing/interfaces/int_cvhighgui.h b/src/c/imageProcessing/interfaces/int_cvhighgui.h index f08ac40b..d8ecf1c6 100644 --- a/src/c/imageProcessing/interfaces/int_cvhighgui.h +++ b/src/c/imageProcessing/interfaces/int_cvhighgui.h @@ -19,7 +19,7 @@ extern "C" { #include "types.h" -#include "opencv2/highgui.hpp" +#include "opencv2/highgui/highgui.hpp" #define g2d0CV_LoadImageim0(filename,name_size,loadtype) imcvLoadImages(filename,loadtype) #define g2im0CV_ShowImageu80(winname,win_size,img) imcvShowImages(winname,img) diff --git a/src/c/imageProcessing/interfaces/int_cvimgproc.h b/src/c/imageProcessing/interfaces/int_cvimgproc.h new file mode 100644 index 00000000..47192e10 --- /dev/null +++ b/src/c/imageProcessing/interfaces/int_cvimgproc.h @@ -0,0 +1,32 @@ +/* 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 +*/ + +#ifndef __INT_CVIMGPROC_H__ +#define __INT_CVIMGPROC_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "types.h" +#include "opencv2/imgproc/imgproc.hpp" + +#define im0im0g2CV_CvtColoru80(src,dst,code,code_size) imcvCvtColors(src,dst,code) +#define im0d0d0g2CV_Thresholdim0(src,threshold,maxvalue,thresh_type,type_size) + imcvThrehold(src,threshold,maxvalue,thresh_type) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*__INT_CVIMGPROC_H__*/ -- cgit From 2790257d385a9d7d9e0dab9205baf4b3df0dd8c8 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++ --- src/c/imageProcessing/cvcore/imcvCreateImages.c | 39 ------------------ src/c/imageProcessing/cvcore/imcvCreateImages.cpp | 46 ++++++++++++++++++++++ src/c/imageProcessing/cvcore/imcvGetImgSizes.c | 32 --------------- src/c/imageProcessing/cvcore/imcvGetImgSizes.cpp | 27 +++++++++++++ src/c/imageProcessing/cvhighgui/imcvLoadImages.c | 23 ----------- src/c/imageProcessing/cvhighgui/imcvLoadImages.cpp | 23 +++++++++++ src/c/imageProcessing/cvhighgui/imcvShowImages.c | 25 ------------ src/c/imageProcessing/cvhighgui/imcvShowImages.cpp | 27 +++++++++++++ src/c/imageProcessing/cvimgproc/imcvCvtColors.c | 27 ------------- src/c/imageProcessing/cvimgproc/imcvCvtColors.cpp | 29 ++++++++++++++ src/c/imageProcessing/cvimgproc/imcvThresholds.c | 27 ------------- src/c/imageProcessing/cvimgproc/imcvThresholds.cpp | 29 ++++++++++++++ src/c/imageProcessing/includes/core.h | 11 ------ src/c/imageProcessing/includes/cvcore.h | 30 -------------- src/c/imageProcessing/includes/cvcore.hpp | 26 ++++++++++++ src/c/imageProcessing/includes/cvhighgui.h | 32 --------------- src/c/imageProcessing/includes/cvhighgui.hpp | 26 ++++++++++++ src/c/imageProcessing/includes/cvimgproc.h | 31 --------------- src/c/imageProcessing/includes/cvimgproc.hpp | 25 ++++++++++++ src/c/imageProcessing/includes/temp.h | 11 ------ src/c/imageProcessing/interfaces/int_cvcore.h | 32 --------------- src/c/imageProcessing/interfaces/int_cvcore.hpp | 26 ++++++++++++ src/c/imageProcessing/interfaces/int_cvhighgui.h | 34 ---------------- src/c/imageProcessing/interfaces/int_cvhighgui.hpp | 28 +++++++++++++ src/c/imageProcessing/interfaces/int_cvimgproc.h | 32 --------------- src/c/imageProcessing/interfaces/int_cvimgproc.hpp | 24 +++++++++++ 26 files changed, 336 insertions(+), 386 deletions(-) delete mode 100644 src/c/imageProcessing/cvcore/imcvCreateImages.c create mode 100644 src/c/imageProcessing/cvcore/imcvCreateImages.cpp delete mode 100644 src/c/imageProcessing/cvcore/imcvGetImgSizes.c create mode 100644 src/c/imageProcessing/cvcore/imcvGetImgSizes.cpp delete mode 100644 src/c/imageProcessing/cvhighgui/imcvLoadImages.c create mode 100644 src/c/imageProcessing/cvhighgui/imcvLoadImages.cpp delete mode 100644 src/c/imageProcessing/cvhighgui/imcvShowImages.c create mode 100644 src/c/imageProcessing/cvhighgui/imcvShowImages.cpp delete mode 100644 src/c/imageProcessing/cvimgproc/imcvCvtColors.c create mode 100644 src/c/imageProcessing/cvimgproc/imcvCvtColors.cpp delete mode 100644 src/c/imageProcessing/cvimgproc/imcvThresholds.c create mode 100644 src/c/imageProcessing/cvimgproc/imcvThresholds.cpp delete mode 100644 src/c/imageProcessing/includes/core.h delete mode 100644 src/c/imageProcessing/includes/cvcore.h create mode 100644 src/c/imageProcessing/includes/cvcore.hpp delete mode 100644 src/c/imageProcessing/includes/cvhighgui.h create mode 100644 src/c/imageProcessing/includes/cvhighgui.hpp delete mode 100644 src/c/imageProcessing/includes/cvimgproc.h create mode 100644 src/c/imageProcessing/includes/cvimgproc.hpp delete mode 100644 src/c/imageProcessing/includes/temp.h delete mode 100644 src/c/imageProcessing/interfaces/int_cvcore.h create mode 100644 src/c/imageProcessing/interfaces/int_cvcore.hpp delete mode 100644 src/c/imageProcessing/interfaces/int_cvhighgui.h create mode 100644 src/c/imageProcessing/interfaces/int_cvhighgui.hpp delete mode 100644 src/c/imageProcessing/interfaces/int_cvimgproc.h create mode 100644 src/c/imageProcessing/interfaces/int_cvimgproc.hpp (limited to 'src/c/imageProcessing') diff --git a/src/c/imageProcessing/cvcore/imcvCreateImages.c b/src/c/imageProcessing/cvcore/imcvCreateImages.c deleted file mode 100644 index 4543b724..00000000 --- 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 - -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 00000000..a04e836a --- /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 + +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.c deleted file mode 100644 index 2faa6271..00000000 --- a/src/c/imageProcessing/cvcore/imcvGetImgSizes.c +++ /dev/null @@ -1,32 +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 convert image object to other color space*/ - -#include "types.h" -#include "cvcore.h" -#include "cvimgproc.h" -#include - -void imcvGetImgSizes(IplImage* src, double* imgsize) -{ - if(src != NULL) - { - imgsize[0] = src->width; - imgsize[1] = src->height; - } - else - { - printf("Error with input image"); - } - -} \ No newline at end of file diff --git a/src/c/imageProcessing/cvcore/imcvGetImgSizes.cpp b/src/c/imageProcessing/cvcore/imcvGetImgSizes.cpp new file mode 100644 index 00000000..0c4e848f --- /dev/null +++ b/src/c/imageProcessing/cvcore/imcvGetImgSizes.cpp @@ -0,0 +1,27 @@ +/* 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 convert image object to other color space*/ + +#include "types.h" +#include "cvcore.hpp" +#include "cvimgproc.hpp" +#include + +using namespace cv; +using namespace std; + +void imcvGetImgSizes(Mat src, double* imgsize) +{ + imgsize[0] = src.rows; + imgsize[1] = src.cols; +} \ No newline at end of file diff --git a/src/c/imageProcessing/cvhighgui/imcvLoadImages.c b/src/c/imageProcessing/cvhighgui/imcvLoadImages.c deleted file mode 100644 index 7c843f94..00000000 --- a/src/c/imageProcessing/cvhighgui/imcvLoadImages.c +++ /dev/null @@ -1,23 +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 load image object from given filename*/ - -#include "types.h" -#include "cvcore.h" -#include "cvhighgui.h" -#include - -IplImage* imcvLoadImages(char *filename, uint8 opentype) -{ - return (cvLoadImage(filename,opentype)); -} \ No newline at end of file diff --git a/src/c/imageProcessing/cvhighgui/imcvLoadImages.cpp b/src/c/imageProcessing/cvhighgui/imcvLoadImages.cpp new file mode 100644 index 00000000..bf7ff07e --- /dev/null +++ b/src/c/imageProcessing/cvhighgui/imcvLoadImages.cpp @@ -0,0 +1,23 @@ +/* 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 load image object from given filename*/ + +#include "types.h" +#include "cvcore.hpp" +#include "cvhighgui.hpp" +#include + +Mat imcvLoadImages(char *filename, uint8 opentype) +{ + return (imread(filename,opentype)); +} \ No newline at end of file diff --git a/src/c/imageProcessing/cvhighgui/imcvShowImages.c b/src/c/imageProcessing/cvhighgui/imcvShowImages.c deleted file mode 100644 index 82ae3ee3..00000000 --- a/src/c/imageProcessing/cvhighgui/imcvShowImages.c +++ /dev/null @@ -1,25 +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 show an image */ - -#include "types.h" -#include "cvcore.h" -#include "cvhighgui.h" -#include - -uint8 imcvShowImages(char *winname, IplImage* img) -{ - cvShowImage(winname,img); - - return (0); -} \ No newline at end of file diff --git a/src/c/imageProcessing/cvhighgui/imcvShowImages.cpp b/src/c/imageProcessing/cvhighgui/imcvShowImages.cpp new file mode 100644 index 00000000..6179c3dc --- /dev/null +++ b/src/c/imageProcessing/cvhighgui/imcvShowImages.cpp @@ -0,0 +1,27 @@ +/* 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 show an image */ + +#include "types.h" +#include "cvcore.hpp" +#include "cvhighgui.hpp" +#include + +using namespace cv; + +uint8 imcvShowImages(char *winname, Mat img) +{ + imshow(winname,img); + + return (0); +} \ No newline at end of file diff --git a/src/c/imageProcessing/cvimgproc/imcvCvtColors.c b/src/c/imageProcessing/cvimgproc/imcvCvtColors.c deleted file mode 100644 index bc2a70ec..00000000 --- a/src/c/imageProcessing/cvimgproc/imcvCvtColors.c +++ /dev/null @@ -1,27 +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 convert image object to other color space*/ - -#include "types.h" -#include "cvcore.h" -#include "cvimgproc.h" -#include - -uint8 imcvCvtColors(IplImage* src, IplImage* dst, char* code) -{ - - if(strcmp(code,"CV_BGR2GRAY") == 0) - cvCvtColor(src,dst,CV_RGB2GRAY); - - return 0; -} \ No newline at end of file diff --git a/src/c/imageProcessing/cvimgproc/imcvCvtColors.cpp b/src/c/imageProcessing/cvimgproc/imcvCvtColors.cpp new file mode 100644 index 00000000..1523afea --- /dev/null +++ b/src/c/imageProcessing/cvimgproc/imcvCvtColors.cpp @@ -0,0 +1,29 @@ +/* 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 convert image object to other color space*/ + +#include "types.h" +#include "cvcore.hpp" +#include "cvimgproc.hpp" +#include + +using namespace cv; + +Mat imcvCvtColors(Mat src, char* code) +{ + Mat dst(src.rows, src.cols, src.type()); + if(strcmp(code,"CV_RGB2GRAY") == 0) + cvtColor(src,dst,CV_RGB2GRAY); + + return dst; +} \ No newline at end of file diff --git a/src/c/imageProcessing/cvimgproc/imcvThresholds.c b/src/c/imageProcessing/cvimgproc/imcvThresholds.c deleted file mode 100644 index cd66c52e..00000000 --- a/src/c/imageProcessing/cvimgproc/imcvThresholds.c +++ /dev/null @@ -1,27 +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 threshold a gray scale image*/ - -#include "types.h" -#include "cvcore.h" -#include "cvimgproc.h" -#include - -IplImage* imcvThresholds(IplImage* src, double threshold, double maxvalue, char* type) -{ - dst = imcvCreates(src->width, src->height, src->,1); - if(strcmp(code,"CV_BGR2GRAY") == 0) - cvCvtColor(src,dst,CV_RGB2GRAY); - - return 0; -} \ No newline at end of file diff --git a/src/c/imageProcessing/cvimgproc/imcvThresholds.cpp b/src/c/imageProcessing/cvimgproc/imcvThresholds.cpp new file mode 100644 index 00000000..2e40de91 --- /dev/null +++ b/src/c/imageProcessing/cvimgproc/imcvThresholds.cpp @@ -0,0 +1,29 @@ +/* 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 threshold a gray scale image*/ + +#include "types.h" +#include "cvcore.hpp" +#include "cvimgproc.hpp" +#include + +using namespace cv; + +Mat imcvThresholds(Mat src, double t_value, double maxvalue, char* type) +{ + Mat dst(src.rows, src.cols, src.type()); + if(strcmp(type,"THRESH_BINARY") == 0) + threshold(src,dst,t_value,maxvalue,THRESH_BINARY); + + return dst; +} \ No newline at end of file diff --git a/src/c/imageProcessing/includes/core.h b/src/c/imageProcessing/includes/core.h deleted file mode 100644 index 1e4c83cb..00000000 --- a/src/c/imageProcessing/includes/core.h +++ /dev/null @@ -1,11 +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 - */ diff --git a/src/c/imageProcessing/includes/cvcore.h b/src/c/imageProcessing/includes/cvcore.h deleted file mode 100644 index 4f04e581..00000000 --- a/src/c/imageProcessing/includes/cvcore.h +++ /dev/null @@ -1,30 +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 -*/ - -#ifndef __CVCORE_H__ -#define __CVCORE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - - -#include "types.h" -#include "opencv2/core/core.hpp" - -IplImage* imcvCreateImages(int width, int height, char *bit_depth, uint8 no_of_ch); -void imcvGetImgSizes(IplImage* src, double* imgsize); -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*__CVCORE_H__*/ diff --git a/src/c/imageProcessing/includes/cvcore.hpp b/src/c/imageProcessing/includes/cvcore.hpp new file mode 100644 index 00000000..78876f7a --- /dev/null +++ b/src/c/imageProcessing/includes/cvcore.hpp @@ -0,0 +1,26 @@ +/* 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 +*/ + +#ifndef __CVCORE_H__ +#define __CVCORE_H__ + + +#include "types.h" +#include "opencv2/core/core.hpp" + +using namespace cv; + +Mat imcvCreateImages(int width, int height, char *bit_depth, uint8 no_of_ch); +void imcvGetImgSizes(Mat src, double* imgsize); + + +#endif /*__CVCORE_H__*/ diff --git a/src/c/imageProcessing/includes/cvhighgui.h b/src/c/imageProcessing/includes/cvhighgui.h deleted file mode 100644 index 2e959a5d..00000000 --- a/src/c/imageProcessing/includes/cvhighgui.h +++ /dev/null @@ -1,32 +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 -*/ - -#ifndef __CVHIGHGUI_H__ -#define __CVHIGHGUI_H__ - -#ifdef __cplusplus -extern "C" { -#endif - - -#include "types.h" -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" - -IplImage* imcvLoadImages(char *filename, uint8 opentype); -uint8 imcvShowImages(char *winname, IplImage* img); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*__CVCORE_H__*/ diff --git a/src/c/imageProcessing/includes/cvhighgui.hpp b/src/c/imageProcessing/includes/cvhighgui.hpp new file mode 100644 index 00000000..167cb63a --- /dev/null +++ b/src/c/imageProcessing/includes/cvhighgui.hpp @@ -0,0 +1,26 @@ +/* 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 +*/ + +#ifndef __CVHIGHGUI_H__ +#define __CVHIGHGUI_H__ + +#include "types.h" +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" + +using namespace cv; + +Mat imcvLoadImages(char *filename, uint8 opentype); +uint8 imcvShowImages(char *winname, Mat img); + + +#endif /*__CVCORE_H__*/ diff --git a/src/c/imageProcessing/includes/cvimgproc.h b/src/c/imageProcessing/includes/cvimgproc.h deleted file mode 100644 index 5d982e49..00000000 --- a/src/c/imageProcessing/includes/cvimgproc.h +++ /dev/null @@ -1,31 +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 -*/ - -#ifndef __CVIMGPROC_H__ -#define __CVIMGPROC_H__ - -#ifdef __cplusplus -extern "C" { -#endif - - -#include "types.h" -#include "opencv2/core/core.hpp" -#include "opencv2/imgproc/imgproc.hpp" - -uint8 imcvCvtColor(IplImage* src, IplImage* dst, char* code); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*__CVIMGPROC_H__*/ diff --git a/src/c/imageProcessing/includes/cvimgproc.hpp b/src/c/imageProcessing/includes/cvimgproc.hpp new file mode 100644 index 00000000..b7d2faa2 --- /dev/null +++ b/src/c/imageProcessing/includes/cvimgproc.hpp @@ -0,0 +1,25 @@ +/* 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 +*/ + +#ifndef __CVIMGPROC_H__ +#define __CVIMGPROC_H__ + +#include "types.h" +#include "opencv2/core/core.hpp" +#include "opencv2/imgproc/imgproc.hpp" + +using namespace cv; + +Mat imcvCvtColors(Mat src, char* code); +Mat imcvThresholds(Mat src, double threshold, double maxvalue, char* type); + +#endif /*__CVIMGPROC_H__*/ diff --git a/src/c/imageProcessing/includes/temp.h b/src/c/imageProcessing/includes/temp.h deleted file mode 100644 index 1e4c83cb..00000000 --- a/src/c/imageProcessing/includes/temp.h +++ /dev/null @@ -1,11 +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 - */ diff --git a/src/c/imageProcessing/interfaces/int_cvcore.h b/src/c/imageProcessing/interfaces/int_cvcore.h deleted file mode 100644 index 5ae0055f..00000000 --- a/src/c/imageProcessing/interfaces/int_cvcore.h +++ /dev/null @@ -1,32 +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 -*/ - -#ifndef __INT_CVCORE_H__ -#define __INT_CVCORE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - - -#include "types.h" -#include "cvcore.h" - -#define d0d0g2d0CV_CreateImageim0(width,height,depth,depth_size,no_of_ch) \ - imcvCreateImages(width,height,depth,no_of_ch) - -#define im0CV_GetImgSized2(img,imgsize) imcvGetImgSizes(img,imgsize) -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*__INT_CVCORE_H__*/ diff --git a/src/c/imageProcessing/interfaces/int_cvcore.hpp b/src/c/imageProcessing/interfaces/int_cvcore.hpp new file mode 100644 index 00000000..82c1313e --- /dev/null +++ b/src/c/imageProcessing/interfaces/int_cvcore.hpp @@ -0,0 +1,26 @@ +/* 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 +*/ + +#ifndef __INT_CVCORE_H__ +#define __INT_CVCORE_H__ + + +#include "types.h" +#include "cvcore.hpp" + +#define d0d0g2d0CV_CreateImagemt0(width,height,depth,depth_size,no_of_ch) \ + imcvCreateImages(width,height,depth,no_of_ch) + +#define mt0CV_GetImgSized2(img,imgsize) imcvGetImgSizes(img,imgsize) + + +#endif /*__INT_CVCORE_H__*/ diff --git a/src/c/imageProcessing/interfaces/int_cvhighgui.h b/src/c/imageProcessing/interfaces/int_cvhighgui.h deleted file mode 100644 index d8ecf1c6..00000000 --- a/src/c/imageProcessing/interfaces/int_cvhighgui.h +++ /dev/null @@ -1,34 +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 -*/ - -#ifndef __INT_CVHIGHGUI_H__ -#define __INT_CVHIGHGUI_H__ - -#ifdef __cplusplus -extern "C" { -#endif - - -#include "types.h" -#include "opencv2/highgui/highgui.hpp" - -#define g2d0CV_LoadImageim0(filename,name_size,loadtype) imcvLoadImages(filename,loadtype) -#define g2im0CV_ShowImageu80(winname,win_size,img) imcvShowImages(winname,img) -#define im0CV_ShowImageu80(img) imcvShowImages("",img) -#define d0CV_WaitKeyu80(delay) cvWaitKey(delay) -#define g2im0CV_SaveImageu80(filename,name_size,img) cvSaveImage(filename,img,NULL) - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*__INT_CVHIGHGUI_H__*/ diff --git a/src/c/imageProcessing/interfaces/int_cvhighgui.hpp b/src/c/imageProcessing/interfaces/int_cvhighgui.hpp new file mode 100644 index 00000000..05f260f6 --- /dev/null +++ b/src/c/imageProcessing/interfaces/int_cvhighgui.hpp @@ -0,0 +1,28 @@ +/* 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 +*/ + +#ifndef __INT_CVHIGHGUI_H__ +#define __INT_CVHIGHGUI_H__ + + +#include "types.h" +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" + +//#define g2d0CV_LoadImageim0(filename,name_size,loadtype) imcvLoadImages(filename,loadtype) +#define g2d0CV_LoadImagemt0(filename,name_size,loadtype) imread(filename,loadtype) +#define g2mt0CV_ShowImageu80(winname,win_size,img) imshow(winname,img) +#define mt0CV_ShowImageu80(img) imshow("",img) +#define d0CV_WaitKeyu80(delay) cvWaitKey(delay) +#define g2mt0CV_SaveImageu80(filename,name_size,img) imwrite(filename,img) + +#endif /*__INT_CVHIGHGUI_H__*/ diff --git a/src/c/imageProcessing/interfaces/int_cvimgproc.h b/src/c/imageProcessing/interfaces/int_cvimgproc.h deleted file mode 100644 index 47192e10..00000000 --- a/src/c/imageProcessing/interfaces/int_cvimgproc.h +++ /dev/null @@ -1,32 +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 -*/ - -#ifndef __INT_CVIMGPROC_H__ -#define __INT_CVIMGPROC_H__ - -#ifdef __cplusplus -extern "C" { -#endif - - -#include "types.h" -#include "opencv2/imgproc/imgproc.hpp" - -#define im0im0g2CV_CvtColoru80(src,dst,code,code_size) imcvCvtColors(src,dst,code) -#define im0d0d0g2CV_Thresholdim0(src,threshold,maxvalue,thresh_type,type_size) - imcvThrehold(src,threshold,maxvalue,thresh_type) - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*__INT_CVIMGPROC_H__*/ diff --git a/src/c/imageProcessing/interfaces/int_cvimgproc.hpp b/src/c/imageProcessing/interfaces/int_cvimgproc.hpp new file mode 100644 index 00000000..65fa77e4 --- /dev/null +++ b/src/c/imageProcessing/interfaces/int_cvimgproc.hpp @@ -0,0 +1,24 @@ +/* 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 +*/ + +#ifndef __INT_CVIMGPROC_H__ +#define __INT_CVIMGPROC_H__ + +#include "types.h" +#include "opencv2/core/core.hpp" +#include "opencv2/imgproc/imgproc.hpp" + +#define mt0g2CV_CvtColormt0(src,code,code_size) imcvCvtColors(src,code) +#define mt0d0d0g2CV_Thresholdmt0(src,threshold,maxvalue,thresh_type,type_size) \ + imcvThresholds(src,threshold,maxvalue,thresh_type) + +#endif /*__INT_CVIMGPROC_H__*/ -- cgit From 9a30882032e80661fe6c69d7c50da0154e4e431f Mon Sep 17 00:00:00 2001 From: siddhu8990 Date: Thu, 22 Sep 2016 10:35:52 +0530 Subject: Image processing functions for blurring, thresholding and edge detection added --- .../cvimgproc/imcvAdaptThresholds.cpp | 47 ++++++++ src/c/imageProcessing/cvimgproc/imcvBlurs.cpp | 55 +++++++++ src/c/imageProcessing/cvimgproc/imcvCanny.cpp | 31 ++++++ .../imageProcessing/cvimgproc/imcvCornerHarris.cpp | 55 +++++++++ src/c/imageProcessing/cvimgproc/imcvCvtColors.cpp | 123 ++++++++++++++++++++- src/c/imageProcessing/cvimgproc/imcvDilate.cpp | 71 ++++++++++++ .../cvimgproc/imcvDistanceTransforms.cpp | 41 +++++++ src/c/imageProcessing/cvimgproc/imcvErode.cpp | 71 ++++++++++++ .../cvimgproc/imcvGaussianBlurs.cpp | 54 +++++++++ .../imageProcessing/cvimgproc/imcvMedianBlurs.cpp | 31 ++++++ src/c/imageProcessing/cvimgproc/imcvThresholds.cpp | 9 ++ src/c/imageProcessing/includes/cvimgproc.hpp | 27 +++++ src/c/imageProcessing/interfaces/int_cvhighgui.hpp | 4 +- src/c/imageProcessing/interfaces/int_cvimgproc.hpp | 51 ++++++++- 14 files changed, 664 insertions(+), 6 deletions(-) create mode 100644 src/c/imageProcessing/cvimgproc/imcvAdaptThresholds.cpp create mode 100644 src/c/imageProcessing/cvimgproc/imcvBlurs.cpp create mode 100644 src/c/imageProcessing/cvimgproc/imcvCanny.cpp create mode 100644 src/c/imageProcessing/cvimgproc/imcvCornerHarris.cpp create mode 100644 src/c/imageProcessing/cvimgproc/imcvDilate.cpp create mode 100644 src/c/imageProcessing/cvimgproc/imcvDistanceTransforms.cpp create mode 100644 src/c/imageProcessing/cvimgproc/imcvErode.cpp create mode 100644 src/c/imageProcessing/cvimgproc/imcvGaussianBlurs.cpp create mode 100644 src/c/imageProcessing/cvimgproc/imcvMedianBlurs.cpp (limited to 'src/c/imageProcessing') diff --git a/src/c/imageProcessing/cvimgproc/imcvAdaptThresholds.cpp b/src/c/imageProcessing/cvimgproc/imcvAdaptThresholds.cpp new file mode 100644 index 00000000..927cfb30 --- /dev/null +++ b/src/c/imageProcessing/cvimgproc/imcvAdaptThresholds.cpp @@ -0,0 +1,47 @@ +/* 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 adaptive threshold a gray scale image*/ + +#include "types.h" +#include "cvcore.hpp" +#include "cvimgproc.hpp" + + +using namespace cv; + +Mat imcvAdaptThresholds(Mat src, double t_value, double maxvalue, char* AdaptiveMethod, \ + char* ThreholdType, double blocksize, double cont) +{ + + Mat dst(src.rows, src.cols, src.type()); + + if(strcmp(AdaptiveMethod,"ADAPTIVE_THRESH_MEAN_C") == 0) + { + if(strcmp(ThreholdType, "THRESH_BINARY") == 0) + adaptiveThreshold(src,dst,maxvalue,ADAPTIVE_THRESH_MEAN_C, \ + THRESH_BINARY,blocksize,cont); + else if(strcmp(ThreholdType, "THRESH_BINARY_INV") == 0) + adaptiveThreshold(src,dst,maxvalue,ADAPTIVE_THRESH_MEAN_C, \ + THRESH_BINARY_INV,blocksize,cont); + } + else if(strcmp(AdaptiveMethod,"ADAPTIVE_THRESH_GAUSSIAN_C") == 0) + { + if(strcmp(ThreholdType, "THRESH_BINARY") == 0) + adaptiveThreshold(src,dst,maxvalue,ADAPTIVE_THRESH_GAUSSIAN_C, \ + THRESH_BINARY,blocksize,cont); + else if(strcmp(ThreholdType, "THRESH_BINARY_INV") == 0) + adaptiveThreshold(src,dst,maxvalue,ADAPTIVE_THRESH_GAUSSIAN_C, \ + THRESH_BINARY_INV,blocksize,cont); + } + return dst; +} \ No newline at end of file diff --git a/src/c/imageProcessing/cvimgproc/imcvBlurs.cpp b/src/c/imageProcessing/cvimgproc/imcvBlurs.cpp new file mode 100644 index 00000000..d5c06de9 --- /dev/null +++ b/src/c/imageProcessing/cvimgproc/imcvBlurs.cpp @@ -0,0 +1,55 @@ +/* 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 adaptive threshold a gray scale image*/ + +#include "types.h" +#include "cvcore.hpp" +#include "cvimgproc.hpp" + + +using namespace cv; + +Mat imcvBlurs(Mat src, double ksize_width, double ksize_height, double anchor_x, \ + double anchor_y, char* border_type) +{ + + /*Mat dst(src.rows, src.cols, src.type());*/ + Mat dst = src.clone(); + + Point anchor = Point(anchor_x,anchor_y); + Size2f ksize = Size2f(ksize_width, ksize_height); + + if(strcmp(border_type,"BORDER_REPLICATE") == 0) + { + blur(src,dst,ksize,anchor,BORDER_REPLICATE); + } + else if(strcmp(border_type,"BORDER_REFLECT")) + { + blur(src,dst,ksize,anchor,BORDER_REFLECT); + } + else if(strcmp(border_type,"BORDER_REFLECT_101")) + { + blur(src,dst,ksize,anchor,BORDER_REFLECT_101); + } + else if(strcmp(border_type,"BORDER_WRAP")) + { + blur(src,dst,ksize,anchor,BORDER_WRAP); + } + else if(strcmp(border_type,"BORDER_CONSTANT")) + { + blur(src,dst,ksize,anchor,BORDER_CONSTANT); + } + + + return dst; +} \ No newline at end of file diff --git a/src/c/imageProcessing/cvimgproc/imcvCanny.cpp b/src/c/imageProcessing/cvimgproc/imcvCanny.cpp new file mode 100644 index 00000000..a81450bf --- /dev/null +++ b/src/c/imageProcessing/cvimgproc/imcvCanny.cpp @@ -0,0 +1,31 @@ +/* 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 find edges in image */ + +#include "types.h" +#include "cvcore.hpp" +#include "cvimgproc.hpp" + + +using namespace cv; + +Mat imcvCanny(Mat src, double threshold1, double threshold2, double \ + aperture_size, double L2gradient) +{ + + Mat dst = src.clone(); + + Canny(src, dst, threshold1, threshold2, aperture_size, L2gradient); + + return dst; +} diff --git a/src/c/imageProcessing/cvimgproc/imcvCornerHarris.cpp b/src/c/imageProcessing/cvimgproc/imcvCornerHarris.cpp new file mode 100644 index 00000000..d6df1cc6 --- /dev/null +++ b/src/c/imageProcessing/cvimgproc/imcvCornerHarris.cpp @@ -0,0 +1,55 @@ +/* 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 find edges using Harris algorithm*/ + +#include "types.h" +#include "cvcore.hpp" +#include "cvimgproc.hpp" + + +using namespace cv; + +Mat imcvCornerHarris(Mat src, double blocksize, double ksize, double k, \ + char* border_type) +{ + + Mat dst(src.rows, src.cols, CV_32FC1); + + if(strcmp(border_type,"BORDER_REPLICATE") == 0) + { + cornerHarris(src,dst,blocksize,ksize,k,BORDER_REPLICATE); + } + else if(strcmp(border_type,"BORDER_REFLECT")) + { + cornerHarris(src,dst,blocksize,ksize,k,BORDER_REFLECT); + } + else if(strcmp(border_type,"BORDER_REFLECT_101")) + { + cornerHarris(src,dst,blocksize,ksize,k,BORDER_REFLECT_101); + } + else if(strcmp(border_type,"BORDER_WRAP")) + { + cornerHarris(src,dst,blocksize,ksize,k,BORDER_WRAP); + } + else if(strcmp(border_type,"BORDER_CONSTANT")) + { + cornerHarris(src,dst,blocksize,ksize,k,BORDER_CONSTANT); + } + else if(strcmp(border_type,"BORDER_DEFAULT")) + { + cornerHarris(src,dst,blocksize,ksize,k,BORDER_DEFAULT); + } + + + return dst; +} \ No newline at end of file diff --git a/src/c/imageProcessing/cvimgproc/imcvCvtColors.cpp b/src/c/imageProcessing/cvimgproc/imcvCvtColors.cpp index 1523afea..eaad278f 100644 --- a/src/c/imageProcessing/cvimgproc/imcvCvtColors.cpp +++ b/src/c/imageProcessing/cvimgproc/imcvCvtColors.cpp @@ -22,8 +22,127 @@ using namespace cv; Mat imcvCvtColors(Mat src, char* code) { Mat dst(src.rows, src.cols, src.type()); + + /*RGB <--> Gray*/ if(strcmp(code,"CV_RGB2GRAY") == 0) - cvtColor(src,dst,CV_RGB2GRAY); + {cvtColor(src,dst,CV_RGB2GRAY);} + else if(strcmp(code,"CV_BGR2GRAY") == 0) + {cvtColor(src,dst,CV_BGR2GRAY);} + else if(strcmp(code,"CV_GRAY2RGB") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_GRAY2RGB);} + else if(strcmp(code,"CV_GRAY2BGR") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_GRAY2BGR);} + + /*RGB <--> CIE XYZ.Rec 709 with D65 white point*/ + else if(strcmp(code,"CV_RGB2XYZ") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_RGB2XYZ);} + else if(strcmp(code,"CV_BGR2XYZ") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BGR2XYZ);} + else if(strcmp(code,"CV_XYZ2RGB") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_XYZ2RGB);} + else if(strcmp(code,"CV_XYZ2BGR") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_XYZ2BGR);} + + /*RGB <--> YCrCb JPEG (or YCC) */ + else if(strcmp(code,"CV_BGR2YCrCb") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BGR2YCrCb);} + else if(strcmp(code,"CV_RGB2YCrCb") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_RGB2YCrCb);} + else if(strcmp(code,"CV_YCrCb2BGR") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_YCrCb2BGR);} + else if(strcmp(code,"CV_YCrCb2RGB") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_YCrCb2RGB);} + + /*RGB <--> HSV */ + else if(strcmp(code,"CV_BGR2HSV") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BGR2HSV);} + else if(strcmp(code,"CV_RGB2HSV") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_RGB2HSV);} + else if(strcmp(code,"CV_HSV2BGR") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_HSV2BGR);} + else if(strcmp(code,"CV_HSV2RGB") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_HSV2RGB);} + + /*RGB <--> HLS */ + else if(strcmp(code,"CV_BGR2HLS") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BGR2HLS);} + else if(strcmp(code,"CV_RGB2HLS") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_RGB2HLS);} + else if(strcmp(code,"CV_HLS2BGR") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_HLS2BGR);} + else if(strcmp(code,"CV_HLS2RGB") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_HLS2RGB);} + /*RGB <--> CIE L*a*b* */ + else if(strcmp(code,"CV_BGR2Lab") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BGR2Lab);} + else if(strcmp(code,"CV_RGB2Lab") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_RGB2Lab);} + else if(strcmp(code,"CV_Lab2BGR") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_Lab2BGR);} + else if(strcmp(code,"CV_Lab2RGB") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_Lab2RGB);} + + /*RGB <--> CIE L*u*v* */ + else if(strcmp(code,"CV_BGR2Luv") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BGR2Luv);} + else if(strcmp(code,"CV_RGB2Luv") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_RGB2Luv);} + else if(strcmp(code,"CV_Luv2BGR") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_Luv2BGR);} + else if(strcmp(code,"CV_Luv2RGB") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_Luv2RGB);} + + /*Bayer <--> RGB */ + else if(strcmp(code,"CV_BayerBG2BGR") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BayerBG2BGR);} + else if(strcmp(code,"CV_BayerGB2BGR") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BayerGB2BGR);} + else if(strcmp(code,"CV_BayerRG2BGR") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BayerRG2BGR);} + else if(strcmp(code,"CV_BayerGR2BGR") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BayerGR2BGR);} + else if(strcmp(code,"CV_BayerBG2RGB") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BayerBG2RGB);} + else if(strcmp(code,"CV_BayerGB2RGB") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BayerGB2RGB);} + else if(strcmp(code,"CV_BayerRG2RGB") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BayerRG2RGB);} + else if(strcmp(code,"CV_BayerBG2RGB") == 0) + {dst.reshape(3); + cvtColor(src,dst,CV_BayerGR2RGB);} return dst; -} \ No newline at end of file +} diff --git a/src/c/imageProcessing/cvimgproc/imcvDilate.cpp b/src/c/imageProcessing/cvimgproc/imcvDilate.cpp new file mode 100644 index 00000000..1659cf58 --- /dev/null +++ b/src/c/imageProcessing/cvimgproc/imcvDilate.cpp @@ -0,0 +1,71 @@ +/* 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 adaptive threshold a gray scale image*/ + +#include "types.h" +#include "cvcore.hpp" +#include "cvimgproc.hpp" + + +using namespace cv; + +Mat imcvDilate(Mat src, char* dilation_type, double size, double iterations, \ + char* border_type, double border_value) +{ + + /*Mat dst(src.rows, src.cols, src.type());*/ + Mat dst = src.clone(); + int dilate_type =0; + + if(strcmp(dilation_type,"MORPH_RECT") == 0) + { + dilate_type = MORPH_RECT; + } + else if(strcmp(dilation_type,"MORPH_CROSS") == 0) + { + dilate_type = MORPH_CROSS; + } + else if(strcmp(dilation_type,"MORPH_ELLIPSE") == 0) + { + dilate_type = MORPH_ELLIPSE; + } + + + Mat element = getStructuringElement(dilate_type, Size(size,size), \ + Point((size-1)/2,(size-1)/2)); + + if(strcmp(border_type,"BORDER_REPLICATE") == 0) + { + dilate(src, dst, element, Point(-1,-1), iterations, BORDER_REPLICATE); + } + else if(strcmp(border_type,"BORDER_REFLECT")) + { + dilate(src, dst, element, Point(-1,-1), iterations, BORDER_REFLECT); + } + else if(strcmp(border_type,"BORDER_REFLECT_101")) + { + dilate(src, dst, element, Point(-1,-1), iterations,BORDER_REFLECT_101); + } + else if(strcmp(border_type,"BORDER_WRAP")) + { + dilate(src, dst, element, Point(-1,-1), iterations, BORDER_WRAP); + } + else if(strcmp(border_type,"BORDER_CONSTANT")) + { + dilate(src, dst, element, Point(-1,-1), iterations, BORDER_CONSTANT, \ + Scalar(border_value)); + } + + + return dst; +} \ No newline at end of file diff --git a/src/c/imageProcessing/cvimgproc/imcvDistanceTransforms.cpp b/src/c/imageProcessing/cvimgproc/imcvDistanceTransforms.cpp new file mode 100644 index 00000000..e53292a5 --- /dev/null +++ b/src/c/imageProcessing/cvimgproc/imcvDistanceTransforms.cpp @@ -0,0 +1,41 @@ +/* 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 adaptive threshold a gray scale image*/ + +#include "types.h" +#include "cvcore.hpp" +#include "cvimgproc.hpp" + + +using namespace cv; + +Mat imcvDistanceTransforms(Mat src, char* distance_type, int mask_size ) +{ + + Mat dst(src.rows, src.cols, CV_32F); + + if(strcmp(distance_type,"CV_DIST_L1") == 0) + { + distanceTransform(src,dst,CV_DIST_L1,mask_size); + } + else if(strcmp(distance_type,"CV_DIST_L2") == 0) + { + distanceTransform(src,dst,CV_DIST_L2,mask_size); + } + else if(strcmp(distance_type,"CV_DIST_C") == 0) + { + distanceTransform(src,dst,CV_DIST_C,mask_size); + } + + return dst; +} \ No newline at end of file diff --git a/src/c/imageProcessing/cvimgproc/imcvErode.cpp b/src/c/imageProcessing/cvimgproc/imcvErode.cpp new file mode 100644 index 00000000..64bae010 --- /dev/null +++ b/src/c/imageProcessing/cvimgproc/imcvErode.cpp @@ -0,0 +1,71 @@ +/* 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 adaptive threshold a gray scale image*/ + +#include "types.h" +#include "cvcore.hpp" +#include "cvimgproc.hpp" + + +using namespace cv; + +Mat imcvErode(Mat src, char* erosion_type, double size, double iterations, \ + char* border_type, double border_value) +{ + + /*Mat dst(src.rows, src.cols, src.type());*/ + Mat dst = src.clone(); + int erode_type =0; + + if(strcmp(erosion_type,"MORPH_RECT") == 0) + { + erode_type = MORPH_RECT; + } + else if(strcmp(erosion_type,"MORPH_CROSS") == 0) + { + erode_type = MORPH_CROSS; + } + else if(strcmp(erosion_type,"MORPH_ELLIPSE") == 0) + { + erode_type = MORPH_ELLIPSE; + } + + + Mat element = getStructuringElement(erode_type, Size(size,size), \ + Point((size-1)/2,(size-1)/2)); + + if(strcmp(border_type,"BORDER_REPLICATE") == 0) + { + erode(src, dst, element, Point(-1,-1), iterations, BORDER_REPLICATE); + } + else if(strcmp(border_type,"BORDER_REFLECT")) + { + erode(src, dst, element, Point(-1,-1), iterations, BORDER_REFLECT); + } + else if(strcmp(border_type,"BORDER_REFLECT_101")) + { + erode(src, dst, element, Point(-1,-1), iterations, BORDER_REFLECT_101); + } + else if(strcmp(border_type,"BORDER_WRAP")) + { + erode(src, dst, element, Point(-1,-1), iterations, BORDER_WRAP); + } + else if(strcmp(border_type,"BORDER_CONSTANT")) + { + erode(src, dst, element, Point(-1,-1), iterations, BORDER_CONSTANT, \ + Scalar(border_value)); + } + + + return dst; +} \ No newline at end of file diff --git a/src/c/imageProcessing/cvimgproc/imcvGaussianBlurs.cpp b/src/c/imageProcessing/cvimgproc/imcvGaussianBlurs.cpp new file mode 100644 index 00000000..3c8c481f --- /dev/null +++ b/src/c/imageProcessing/cvimgproc/imcvGaussianBlurs.cpp @@ -0,0 +1,54 @@ +/* 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 adaptive threshold a gray scale image*/ + +#include "types.h" +#include "cvcore.hpp" +#include "cvimgproc.hpp" + + +using namespace cv; + +Mat imcvGaussianBlurs(Mat src, double ksize_width, double ksize_height, + double sigma_x, double sigma_y, char* border_type) +{ + + /*Mat dst(src.rows, src.cols, src.type());*/ + Mat dst = src.clone(); + + Size2f ksize = Size2f(ksize_width, ksize_height); + + if(strcmp(border_type,"BORDER_REPLICATE") == 0) + { + GaussianBlur(src,dst,ksize,sigma_x,sigma_y,BORDER_REPLICATE); + } + else if(strcmp(border_type,"BORDER_REFLECT")) + { + GaussianBlur(src,dst,ksize,sigma_x,sigma_y,BORDER_REFLECT); + } + else if(strcmp(border_type,"BORDER_REFLECT_101")) + { + GaussianBlur(src,dst,ksize,sigma_x,sigma_y,BORDER_REFLECT_101); + } + else if(strcmp(border_type,"BORDER_WRAP")) + { + GaussianBlur(src,dst,ksize,sigma_x,sigma_y,BORDER_WRAP); + } + else if(strcmp(border_type,"BORDER_CONSTANT")) + { + GaussianBlur(src,dst,ksize,sigma_x,sigma_y,BORDER_CONSTANT); + } + + + return dst; +} \ No newline at end of file diff --git a/src/c/imageProcessing/cvimgproc/imcvMedianBlurs.cpp b/src/c/imageProcessing/cvimgproc/imcvMedianBlurs.cpp new file mode 100644 index 00000000..d8e90ff9 --- /dev/null +++ b/src/c/imageProcessing/cvimgproc/imcvMedianBlurs.cpp @@ -0,0 +1,31 @@ +/* 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 adaptive threshold a gray scale image*/ + +#include "types.h" +#include "cvcore.hpp" +#include "cvimgproc.hpp" + + +using namespace cv; + +Mat imcvMedianBlurs(Mat src, double ksize) +{ + + /*Mat dst(src.rows, src.cols, src.type());*/ + Mat dst = src.clone(); + + medianBlur(src,dst,(int)ksize); + + return dst; +} \ No newline at end of file diff --git a/src/c/imageProcessing/cvimgproc/imcvThresholds.cpp b/src/c/imageProcessing/cvimgproc/imcvThresholds.cpp index 2e40de91..9664a44c 100644 --- a/src/c/imageProcessing/cvimgproc/imcvThresholds.cpp +++ b/src/c/imageProcessing/cvimgproc/imcvThresholds.cpp @@ -22,8 +22,17 @@ using namespace cv; Mat imcvThresholds(Mat src, double t_value, double maxvalue, char* type) { Mat dst(src.rows, src.cols, src.type()); + if(strcmp(type,"THRESH_BINARY") == 0) threshold(src,dst,t_value,maxvalue,THRESH_BINARY); + if(strcmp(type,"THRESH_BINARY_INV") == 0) + threshold(src,dst,t_value,maxvalue,THRESH_BINARY_INV); + if(strcmp(type,"THRESH_TRUNC") == 0) + threshold(src,dst,t_value,maxvalue,THRESH_TRUNC); + if(strcmp(type,"THRESH_TOZERO") == 0) + threshold(src,dst,t_value,maxvalue,THRESH_TOZERO); + if(strcmp(type,"THRESH_TOZERO_INV") == 0) + threshold(src,dst,t_value,maxvalue,THRESH_TOZERO_INV); return dst; } \ No newline at end of file diff --git a/src/c/imageProcessing/includes/cvimgproc.hpp b/src/c/imageProcessing/includes/cvimgproc.hpp index b7d2faa2..8fdf3e39 100644 --- a/src/c/imageProcessing/includes/cvimgproc.hpp +++ b/src/c/imageProcessing/includes/cvimgproc.hpp @@ -20,6 +20,33 @@ using namespace cv; Mat imcvCvtColors(Mat src, char* code); + Mat imcvThresholds(Mat src, double threshold, double maxvalue, char* type); +Mat imcvAdaptThresholds(Mat src, double t_value, double maxvalue, char* AdaptiveMethod, \ + char* ThreholdType, double blocksize, double C); + +Mat imcvDistanceTransforms(Mat src, char* distance_type, int mask_size); + + +Mat imcvBlurs(Mat src, double ksize_width, double ksize_height, double anchor_x, \ + double anchor_y, char* border_type); + +Mat imcvGaussianBlurs(Mat src, double ksize_width, double ksize_height, double sigma_x, \ + double sigma_y, char* border_type); + +Mat imcvMedianBlurs(Mat src, double ksize); + +Mat imcvErode(Mat src, char* erosion_type, double size, double iterations, \ + char* border_type, double border_value); + +Mat imcvDilate(Mat src, char* dilation_type, double size, double iterations, \ + char* border_type, double border_value); + +Mat imcvCanny(Mat src, double threshold1, double threshold2, double \ + aperture_size, double L2gradient); + +Mat imcvCornerHarris(Mat src, double blocksize, double ksize, double k, \ + char* border_type); + #endif /*__CVIMGPROC_H__*/ diff --git a/src/c/imageProcessing/interfaces/int_cvhighgui.hpp b/src/c/imageProcessing/interfaces/int_cvhighgui.hpp index 05f260f6..8e1a989e 100644 --- a/src/c/imageProcessing/interfaces/int_cvhighgui.hpp +++ b/src/c/imageProcessing/interfaces/int_cvhighgui.hpp @@ -20,8 +20,8 @@ //#define g2d0CV_LoadImageim0(filename,name_size,loadtype) imcvLoadImages(filename,loadtype) #define g2d0CV_LoadImagemt0(filename,name_size,loadtype) imread(filename,loadtype) -#define g2mt0CV_ShowImageu80(winname,win_size,img) imshow(winname,img) -#define mt0CV_ShowImageu80(img) imshow("",img) +#define g2mt0CV_ShowImageu80(winname,win_size,img) imcvShowImages(winname,img) +#define mt0CV_ShowImageu80(img) imcvShowImages("",img) #define d0CV_WaitKeyu80(delay) cvWaitKey(delay) #define g2mt0CV_SaveImageu80(filename,name_size,img) imwrite(filename,img) diff --git a/src/c/imageProcessing/interfaces/int_cvimgproc.hpp b/src/c/imageProcessing/interfaces/int_cvimgproc.hpp index 65fa77e4..9b1a85c9 100644 --- a/src/c/imageProcessing/interfaces/int_cvimgproc.hpp +++ b/src/c/imageProcessing/interfaces/int_cvimgproc.hpp @@ -18,7 +18,54 @@ #include "opencv2/imgproc/imgproc.hpp" #define mt0g2CV_CvtColormt0(src,code,code_size) imcvCvtColors(src,code) -#define mt0d0d0g2CV_Thresholdmt0(src,threshold,maxvalue,thresh_type,type_size) \ - imcvThresholds(src,threshold,maxvalue,thresh_type) + +#define mt0d0d0g2CV_Thresholdmt0(src,threshold,maxvalue,thresh_type, \ + type_size) imcvThresholds(src,threshold,maxvalue,thresh_type) + +#define mt0d0g2g2d0d0CV_AdaptiveThresholdmt0(src,maxvalue,adaptmethod, \ + adapt_size,thresh_type,blocksize,C) imcvAdaaptThresholds(src, \ + maxvalue,adaptmethod,thresh_type,blocksize,C) + +#define mt0g2d0CV_DistanceTransform(src,distance_type,type_size,mask_size) \ + imcvDistanceTransform(src,distance_type,mask_size) + +#define mt0d0d0d0d0g2CV_Blurmt0(src,ksize_width,ksize_height,anchor_x, \ + anchor_y,border_type,type_size) imcvBlurs(src,ksize_width, \ + ksize_height,anchor_x,anchor_y,border_type) + +#define mt0d0d0d0d0g2CV_GaussianBlurmt0(src,ksize_width,ksize_height,sigma_x, \ + sigma_y,border_type,type_size) imcvGaussianBlurs(src,ksize_width, \ + ksize_height,sigma_x,sigma_y,border_type) + +#define mt0d0CV_MedianBlurmt0(src,ksize) imcvMedianBlurs(src,ksize) + +#define mt0g2d0CV_Erodemt0(src,erosion_type,type_size,erosion_size) \ + imcvErode(src,erosion_type,erosion_size,1,"BORDER_CONSTANT",0) + +#define mt0g2d0d0g2d0CV_Erodemt0(src,erosion_type,type_size,erosion_size, \ + iterations,border_type,bor_size,border_value) \ + imcvErode(src,erosion_type,erosion_size,iterations,border_type, \ + border_value) + +#define mt0g2d0CV_Dilatemt0(src,dilation_type,type_size,dilation_size) \ + imcvDilate(src,dilation_type,dilation_size,1,"BORDER_CONSTANT",0) + +#define mt0g2d0d0g2d0CV_Dilatemt0(src,dilation_type,type_size,dilation_size, \ + iterations,border_type,bor_size,border_value) \ + imcvDilate(src,dilation_type,dilation_size,iterations,border_type, \ + border_value) + +#define mt0d0d0d0d0CV_Cannymt0(src,threshold1,threshold2,aperture_size, \ + L2gradient) imcvCanny(src,threshold1,threshold2,aperture_size, \ + L2gradient) + +#define mt0d0d0CV_Cannymt0(src,threshold1,threshold2) imcvCanny(src, \ + threshold1,threshold2,3,0) + +#define mt0d0d0d0g2CV_CornerHarrismt0(src,blocksize,ksize,k,border_type, \ + type_size) imcvCornerHarris(src,blocksize,ksize,k,border_type) + +#define mt0d0d0d0CV_CornerHarrismt0(src,blocksize,ksize,k) \ + imcvCornerHarris(src,blocksize,ksize,k,"BORDER_DEFAULT") #endif /*__INT_CVIMGPROC_H__*/ -- cgit From 52de97290366abe6cfb0576ca19d9c1732c1f0ea Mon Sep 17 00:00:00 2001 From: siddhu8990 Date: Tue, 18 Oct 2016 10:31:23 +0530 Subject: Suppressed declaration of not required variables and functions --- src/c/imageProcessing/interfaces/int_cvhighgui.hpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/c/imageProcessing') diff --git a/src/c/imageProcessing/interfaces/int_cvhighgui.hpp b/src/c/imageProcessing/interfaces/int_cvhighgui.hpp index 8e1a989e..60d6ffdd 100644 --- a/src/c/imageProcessing/interfaces/int_cvhighgui.hpp +++ b/src/c/imageProcessing/interfaces/int_cvhighgui.hpp @@ -20,9 +20,16 @@ //#define g2d0CV_LoadImageim0(filename,name_size,loadtype) imcvLoadImages(filename,loadtype) #define g2d0CV_LoadImagemt0(filename,name_size,loadtype) imread(filename,loadtype) -#define g2mt0CV_ShowImageu80(winname,win_size,img) imcvShowImages(winname,img) -#define mt0CV_ShowImageu80(img) imcvShowImages("",img) -#define d0CV_WaitKeyu80(delay) cvWaitKey(delay) -#define g2mt0CV_SaveImageu80(filename,name_size,img) imwrite(filename,img) +#define g2mt0CV_ShowImageu80(winname,win_size,img) imshow(winname,img) +#define mt0CV_ShowImage(img) imshow("",img) + +#define d0CV_WaitKey(delay) waitKey((int)delay) +#define s80CV_WaitKey(delay) waitKey((int)delay) +#define u80CV_WaitKey(delay) waitKey((int)delay) +#define i80CV_WaitKey(delay) waitKey((int)delay) +#define u160CV_WaitKey(delay) waitKey((int)delay) +#define i160CV_WaitKey(delay) waitKey((int)delay) + +#define g2mt0CV_SaveImage(filename,name_size,img) imwrite(filename,img) #endif /*__INT_CVHIGHGUI_H__*/ -- cgit