Java DIP Basic Thresholding - Digital image processing

What is Basic Thresholding in DIP?

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.

Example

Below mentioned example describes about the use of Imgproc class to perform thresholding operations to an image:

Output

Once you execute the given code, the following output is seen:

Original Image

original

After applying the thresholding operations on above image it is shos shown in the output below:

Thresh Binary

Thresh Binary

Thresh Binary Invert

Thresh Binary Invert

Thresh Zero

Thresh Zero

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Digital image processing Topics