Intensity Level Slicing
unknown
matlab
a year ago
845 B
13
Indexable
% FLIP THE CAMERA MAN
% Reading an image : I stores the pixel wise colour values of the image
I = imread("cameraman.tif"); % tif is used for grayscale images
[m,n] = size(I); % reading the dimensions of the image
J = zeros(m,n); % creating a blank matrix filled with zeros
% Defining the range which shows black
lower_T = 0; % upper threshold value
upper_T = 100; % lower threshold value
for i = 1:m % row wise matrix traversal
for j = 1:n % column wise matrix traversal
if( lower_T < I(i,j) && I(i,j) < upper_T)
J(i,j) = 255; % fill white colour
else
J(i,j) = I(i,j); %fill original colour
end % ending of if condition
end % ending of inner for loop
end % ending of outer for loop
figure, subplot (1,2,1), imshow(I);
subplot(1,2,2), imshow(J,[]);Editor is loading...
Leave a Comment