Professional Documents
Culture Documents
Experiment 6B 10-244
Experiment 6B 10-244
Objective: In this experiment, student should be able to understand the formula to perform thresholding of
a black and white image.
PEO to be achieved:
Pre Lab/ Prior Concepts: Basic MATLAB knowledge of the standard formula to obtain Digital
Negative
______________________________________________________________________________________
Historical Profile:
Sezgin and Sankur (2004) categorize thresholding methods into the following six groups based on the
information the algorithm manipulates
New Concepts to be learned: How to set the pixel values to their minimum or maximum grey level.
Start
Stop
Stepwise Procedure:
1. Open Matlab software
2. Goto New Script
3. Write the program code given below.
4. Save the code with an “.m” extension.
5. Run the code to get the output.
Program Code:
r=imread('cameraman.tif');
[x y]=size(r);
r1=input('Enter r1 : ');
for i=1:x
for j=1:y
if(r1<=r(i,j) && r(i,j)<=255)
rcs(i,j)=255;
else
rcs(i,j)=0;
end
end
Experiment 6B 10-244
end
subplot(1,2,1);
imshow(r);
subplot(1,2,2);
imshow(rcs);
Output:
Enter r1 : 100
Conclusion: Therefore we obtained a black and white image of the original image.
_________________________________________________________________________
_______
Viva Questions:
1. Define Thresholding
Contrast is the difference in luminance and/or color that makes an object (or its
representation in an image or display) distinguishable. In visual perception of the real world,
contrast is determined by the difference in the color and brightness of the object and other
objects within the same field of view.
_________________________________________________________________________
_______