Java DIP Enhancing Image Contrast - Digital image processing

How to enhance image contrast in DIP?

This chapter explains how to increase the contrast of an image with the help of histogram equalization.

Here we use OpenCV function equalizeHist() method. You can find this under Imgproc package. Here’s the syntax is given below:

The parameters are described below:

Sr.No.

Paramaeters

1

Source

It is 8-bit single channel source image.

2

Destination

It is the destination image.

Other than the equalizeHist() method, the other methods offered by the Imgproc class. Let’s discuss about them:

Sr.No.

Method

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 discusses about the use of Imgproc class to enhance contrast of an image:

Output

Original Image

grayscale

Enhanced Contrast Image

contrast

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

Digital image processing Topics