diff options
Diffstat (limited to 'src/c/imageProcessing/cvimgproc')
-rw-r--r-- | src/c/imageProcessing/cvimgproc/imcvAdaptThresholds.cpp | 47 | ||||
-rw-r--r-- | src/c/imageProcessing/cvimgproc/imcvBlurs.cpp | 55 | ||||
-rw-r--r-- | src/c/imageProcessing/cvimgproc/imcvCanny.cpp | 31 | ||||
-rw-r--r-- | src/c/imageProcessing/cvimgproc/imcvCornerHarris.cpp | 55 | ||||
-rw-r--r-- | src/c/imageProcessing/cvimgproc/imcvCvtColors.cpp | 123 | ||||
-rw-r--r-- | src/c/imageProcessing/cvimgproc/imcvDilate.cpp | 71 | ||||
-rw-r--r-- | src/c/imageProcessing/cvimgproc/imcvDistanceTransforms.cpp | 41 | ||||
-rw-r--r-- | src/c/imageProcessing/cvimgproc/imcvErode.cpp | 71 | ||||
-rw-r--r-- | src/c/imageProcessing/cvimgproc/imcvGaussianBlurs.cpp | 54 | ||||
-rw-r--r-- | src/c/imageProcessing/cvimgproc/imcvMedianBlurs.cpp | 31 | ||||
-rw-r--r-- | src/c/imageProcessing/cvimgproc/imcvThresholds.cpp | 9 |
11 files changed, 586 insertions, 2 deletions
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 |