|
|
Thresholding helps to get image segmentation in the easiest way. Image segmentation performs dividing the total image into a set of pixels in that way the pixels in each set include some common characteristics. Image segmentation is more in defining objects and their boundaries.
This chapter explains about the basic thresholding operations on images.
Here we use OpenCV function threshold. It can be found under Imgprocpackage. Its syntax is given below:
The parameters are described below:
Sr.No. |
Parameters |
1 |
source It is source image. |
2 |
destination It is destination image. |
3 |
thresh It is threshold value. |
4 |
maxval It is the maximum value to be used with the THRESH_BINARY and THRESH_BINARY_INV threshold types. |
5 |
type The possible types are THRESH_BINARY, THRESH_BINARY_INV, THRESH_TRUNC, and THRESH_TOZERO. |
Other than these thresholding methods, the other methods provided by the Imgproc class are discussed here.
Sr.No. |
Methods |
1 |
cvtColor(Mat src, Mat dst, int code, int dstCn) It converts an image from one color space to another. |
2 |
dilate(Mat src, Mat dst, Mat kernel) It dilates an image by using a specific structuring element. |
3 |
equalizeHist(Mat src, Mat dst) It equalizes the histogram of a grayscale image. |
4 |
filter2D(Mat src, Mat dst, int ddepth, Mat kernel, Point anchor, double delta) It convolves an image with the kernel. |
5 |
GaussianBlur(Mat src, Mat dst, Size ksize, double sigmaX) It blurs an image using a Gaussian filter. |
6 |
integral(Mat src, Mat sum) It calculates the integral of an image. |
Below mentioned example describes about the use of Imgproc class to perform thresholding operations to an image:
Once you execute the given code, the following output is seen:
After applying the thresholding operations on above image it is shos shown in the output below:
|
|
Digital image processing Related Tutorials |
|
---|---|
Python Tutorial | MATLAB Tutorial |
wxPython Tutorial | Digital Signal Processing Tutorial |
Digital image processing Related Practice Tests |
|
---|---|
Python Practice Tests | MATLAB Practice Tests |
Machine design Practice Tests |
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.