0% found this document useful (0 votes)
99 views6 pages

Group No: 50 ROLL NO: 1704108: EXPERIMENT 6: Implement Image Negative, Gray Level Slicing and Thresholding

1. The document describes three image processing techniques: image negative, thresholding, and gray level slicing. 2. Image negative inverts the pixel values of an image, thresholding extracts portions of an image above or below a threshold value, and gray level slicing manipulates groups of pixel intensities within a specified range. 3. Code examples are provided to implement each technique on an input image and display the results.

Uploaded by

Rohit Shambwani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
99 views6 pages

Group No: 50 ROLL NO: 1704108: EXPERIMENT 6: Implement Image Negative, Gray Level Slicing and Thresholding

1. The document describes three image processing techniques: image negative, thresholding, and gray level slicing. 2. Image negative inverts the pixel values of an image, thresholding extracts portions of an image above or below a threshold value, and gray level slicing manipulates groups of pixel intensities within a specified range. 3. Code examples are provided to implement each technique on an input image and display the results.

Uploaded by

Rohit Shambwani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

GROUP NO: 50 ROLL NO: 1704108

EXPERIMENT 6: Implement image negative, gray level slicing and


thresholding

Theory:

Point Processing Techniques are among the simplest of all image enhancement techniques.

1. Negative of an Image:

The simple operation in image processing is to compute the negative of an image. It


can be done by reversing the pixel values from black to white and white to black.
Intensity of output image decreases as intensity of input image increases.

2. Thresholding:

It is a process of extracting a part of an image which contains information. In this


transformation, one threshold level is set and pixel values below threshold are to be
taken as 0 and above values are taken as 255.
Intermediate values of r1, r2, s1 and s2 produce various degrees of grey levels at
output which affects its contrast as shown in fig.

3. Gray Level Slicing with Background:

Grey level slicing is equivalent to band pass filtering. It manipulates groups of


intensity levels in an image up to specific range by diminishing rest or by leaving
them alone. This transformation is applicable in medical images and satellite images
such as X-ray flaws, CT scan. Two different approaches are adopted for grey level
slicing.
4. Gray Level Slicing without Background:

It displays high values in the specific region of an image and low values to other
regions by ignoring background.
NEGATIVE IMAGE
a = imread("My_photo.jpg");

sz = size(a);

for i = 1: sz(1)

for j = 1:sz(2)

b(i, j ) = 256 -1- a(i, j);

end

end
figure(1);

imshow(a);

figure(2);

imshow(b)

Original Image

Negative Index
THRESHOLDING
image = imread('My_photo.jpg');

[r,c] = size(image);

s = image;

for i=1:r

for j=1:c
if(s(i,j)<100)

s(i,j) = 1;

end

end

end
figure(1),imshow(image);title('Original image');

figure(2),imshow(s);title('Thresholding image');

Original Image Threshold Image


GRAY LEVEL SLICING
img = imread('My_photo.jpg');
img = rgb2gray(img);

without_background = uint8(img);

with_background = uint8(img);

[n,m] = size(without_background);

l = 256;

for i=1:n

for j=1:m
%With out BackGround

if(without_background(i,j)>120 & without_background(i,j)<220)

without_background(i,j) = l-1;

else
without_background(i,j) = 0;

end

%With BackGround

if(with_background(i,j)>120 & with_background(i,j)<220)


with_background(i,j) = l-1;

end

end

end
figure,imshow(img);title('Original Image');

figure;

imshow(without_background); title('Gray Level Slicing Without BackGround');

for i=1:n
for j=1:m
%With BackGround

if(without_background(i,j)>120 & without_background(i,j)<220)

without_background(i,j) = l-1;
end

end

end

figure;
imshow(with_background); title('Gray Level Slicing With BackGround');

Gray level Slicing without background Gray level Slicing with Background

You might also like