image processing LAB # 03: Transformation Operations Lab Objective: The objective of this lab is to implement thresholding on images to conve

image processing

LAB # 03: Transformation Operations

Don't use plagiarized sources. Get Your Custom Assignment on
image processing LAB # 03: Transformation Operations Lab Objective: The objective of this lab is to implement thresholding on images to conve
From as Little as $13/Page

Lab Objective:

The objective of this lab is to implement thresholding on images to convert them to binary, perform

different transformation operations on images.

Lab Description:

Transformation operations help enhance the quality of the image by applying operations like

log, inverse log and power on the entire image. Different type of transformation yields different

results.

Gray level transformation

There are three basic gray level transformation.

I. Linear

II. Logarithmic

III. Power law

The overall graph of these transitions has been shown below.

Transformation curves

Power law transformations:It includes nth power and nth root transformation. These

transformations can be given by the expression:

Digital Image Processing Lab Manual

1

s=cr^

This symbol is called gamma, due to which this transformation is also known as gamma

transformation.

Variation in the value of varies the enhancement of the images. Different display devices /

monitors have their own gamma correction, thats why they display their image at different

intensity.

This type of transformation is used for enhancing images for different type of display devices.

The gamma of different display devices is different. For example Gamma of CRT lies in between

of 1.8 to 2.5, that means the image displayed on CRT is dark.

Correcting gamma.

s=cr^

s=cr^(1/2.5)

The same image but with different gamma values has been shown here.

ccccccGamma 8 Gamma 6 Gamma 10

Log transformations

The log transformations can be defined by this formula

s = c log(r + 1).

Where s and r are the pixel values of the output and the input image and c is a constant. The value

1 is added to each of the pixel value of the input image because if there is a pixel intensity of 0 in

the image, then log (0) is equal to infinity. So 1 is added, to make the minimum value at least 1.

During log transformation, the dark pixels in an image are expanded as compare to the higher

pixel values. The higher pixel values are kind of compressed in log transformation.

Digital Image Processing Lab Manual

2

Input image output of log transformation

.

Negative Transformation

The second linear transformation is negative transformation, which is invert of identity

transformation. In negative transformation, each value of the input

image is subtracted from the L-1 and mapped onto the output image.

This transformation is done by this formula

s = (L 1) r

So each value is subtracted by 255,so the lighter pixels become dark

and the darker picture becomes light. And it results in image negative.

Negative transformation

Thresholding is the operation through which an image can be converted into a binary image/black

& white i.e. having only two distinct levels. Threshold value can be the mean or median etc. of the

image.

Gray level Slicing is used to highlight a specific range of gray levels in an image

Some Useful Commands:

1. To calculate the mean of 2D array using NumPy: my_mean = numpy.mean (my_array)

2. To calculate min (or max) of an array: my_min = numpy.amin(my_array)

3. To calculate the power of an array using NumPy: array_power = numpy.power (my_array,

power)

4. To obtain percentile value. percentile_array = numpy.percentile(my_array, percentile)

5. To change data type of array. my_array = my_array.astype(numpy.uint16)

Digital Image Processing Lab Manual

3

Lab Tasks:

1: Apply following transformation techniques on image provided and observe the output image

of each transformation.

I. Negative transformation

II. Log transformation

2: Apply the following transformation on an image.

Pixel values range Output pixel value

a) Less than mean

Greater than mean

0

255

b) Less than mean

Greater than mean

255

0

c) 20 mean

Otherwise

0

255

3:Apply Power Law transformation for the following values of (0.2, 0.5, 1.2 and 1.8) . Make

sure to adjust data types accordingly.

4:Apply Gray level slicing using lower limit 100 and upper limit 200. Set all these values to 210.

Bit plane slicing

Bit plane slicing is a method of representing an image with one or more bits of the byte used for

each pixel. One can use only MSB to represent the pixel, which reduces the original gray level to

a binary image. Main objective of this technique is:

To highlight the contribution made to the total image appearance by specific bits.

a) Assuming that each pixel is represented by 8 bits, the image is composed
of 8 1-bit planes.

Digital Image Processing Lab Manual

4

b) Plane 1 contains the least significant bit and plane 8 contains most
significant

c) Useful for analyzing the relative importance played by each bit of the
image.

Fig: Bit plane slicing

Home Task:

Perform Bit Plane Slicing on given image. An application of this technique is data compression.

In general, 8-bit per pixel images are processed. Slice the provided image into following bit

planes (0,1,2,3,4,5,6,7). Save the output of each slicing.

Fig:coin img

Applications:

i. Enhancement of image for different type of display devices.

Digital Image Processing Lab Manual

5

ii. Power-law transformation for enhanced recognition of born-digital word images

iii. Image Enhancement by Adaptive Power-Law Transformations

References:

I. http://www.cs.uregina.ca/Links/class-info/425/Lab3/

II. https://www.tutorialspoint.com/dip/gray_level_transformations.htm

THINK!!

1) What is the difference between enhancing image using power law transformation and

contrast stretching?

2) If an image is dark what can be the gamma value to visualize it better?

3) If we want to enhance only a certain range of pixel values, which of the following above

mentioned methods can be used?

http://www.bing.com/search?q=ii.%09Power-law+transformation+for+enhanced+recognition+of+born-digital+word+images&src=IE-TopResult&FORM=IETR02&conversationid=

https://www.bahria.edu.pk/ojs/index.php/bujict/article/view/26

http://www.cs.uregina.ca/Links/class-info/425/Lab3/

https://www.tutorialspoint.com/dip/gray_level_transformations.htm

Leave a Comment

Your email address will not be published. Required fields are marked *