DIP - Exp 5 [ Thresholding ]

 clc;

close all;
clear all;
a = imread('sample.jpg');
a = rgb2gray(a);
subplot(3,2,1);
imshow(a); title('Original Image');
level = 0.3;
subplot(3,2,2);
segimage1 = im2bw(a,level);
imshow(segimage1); title('Simple Thresholding at 0.3');
subplot(3,2,3);
imshow(a > 153); title('Simple Thresholding at 0.6');
tmp = a;
[m n]= find(a<26);
for j = 1: length(m)
tmp(m(j),n(j))=0;
end
[m n]= find(a>26 & a <= 230);
for j = 1: length(m)
tmp(m(j),n(j))=0.8;
end
[m n]= find(a>230);
for j = 1: length(m)
tmp(m(j),n(j))=0;
end
subplot(3,2,4);
segimage2 = im2bw(tmp,0);
imshow(segimage2); title('Multiple threshoding(Between 26-230)');
level = graythresh(a);
subplot(3,2,5);
segimage = im2bw(a,level);
imshow(segimage); title('Otsu - Optimal Segmented Image');
Next Post Previous Post
No Comment
Add Comment
comment url