Java DIP Enhancing Image Brightness - Digital image processing

How to enhance image brightness in DIP?

This chapter explains about how to increase the brightness of an image by multiplying each pixel of the image with an alpha value and adding another beta value to it.

The OpenCV function convertTo that performs above function automatically. You can see this under Mat package. Its syntax is given below:

Let’s describe the parameters :

Sr.No.

Parameters

1

destination

It is destination image.

2

rtype

It is desired output matrix type or, rather the depth, since the number of channels are the same as the input has. if rtype is negative, the output matrix will have the same type as the input.

3

alpha

It is optional scale factor.

4

beta

It is optional delta added to the scaled values.

Other than the convertTo method, the other methods available are Mat class. They are described briefly:

Sr.No.

Methods

1

adjustROI(int dtop, int dbottom, int dleft, int dright)

It adjusts a submatrix size and position within the parent matrix.

2

copyTo(Mat m)

It copies the matrix to another one.

3

diag()

It extracts a diagonal from a matrix, or creates a diagonal matrix.

4

dot(Mat m)

It computes a dot-product of two vectors.

5

reshape(int cn)

It changes the shape and/or the number of channels of a 2D matrix without copying the data.

6

submat(Range rowRange, Range colRange)

It extracts a rectangular sub matrix.

Example

Below example describes the use of Mat class to increase the brightness of an image:

Output

After executing the above code , the following output is seen:

Original Image

Original image

Enhanced Bright Image (Alpha=1 & Beta=50)

enhancing brightness

Enhanced Bright Image (Alpha=2 & Beta=50)

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

Digital image processing Topics