Matlab Code for Performs Gray Level Slicing without Preserving Background

a=imread(‘cameraman.tif’);     % Read the input image

a1=double(a); % Convert the image into double format for performing complex operations

imshow(a)

[m n]=size(a1);

x=150;  % intensity limit range x and y . In this program i am highlighting the pixel values lies between 150 to 200 as 255 (bright pixel value and other pixel value as 0 dark pixel value).

y=200;

for i= 1:m

            for j= 1:n

                       if (a1(i,j)>=x & a1(i,j)<=y)      % Comparing each pixel of the image with the limit

                                      b(i,j)=255;

                              else

                                        b(i,j)=0;       

                         end

                   end

      end

figure

imshow(b);

imshow(uint8(b)); % Convert into uint8 format for display the image


Contact:
Mr. Roshan P. Helonde
Mobile: +91-7276355704
WhatsApp: +91-7276355704
Email: roshanphelonde@rediffmail.com
Share:

Total Pageviews

CONTACT US

Prof. Roshan P. Helonde
Mobile: +917276355704
WhatsApp: +917276355704
Email: roshanphelonde@rediffmail.com

Enter Project Title

Popular Projects

All Archive

Contact Form

Name

Email *

Message *