%%
%%this program read an RGB image and conver it to grayscale image%%%
%%%%ask the user to enter image name%%%
d=input('Enter image file name ','s')
I=imread(d);%%%read the intered image%%%
imshow(I)%%%show the image as a figure%%%
%%
k=input('type 1 if you want cnvertion RGB to GRAY and use image large tool OR 0 if no ','s')%%%let the user choice this cell or not%%%
if (k>='1')
I = rgb2gray(I);%%cnverting the image from RGB format to grayscale format%%%
imtool(I);%%%then allow the user to%%%
%%%know the distance between two points in the image%%%
end
%%
k=input('type 1 if you want segmantation OR 0 if no ','s')
if (k>='1')
f2=im2double(I);
choice=0;
while (choice~=5)
choice=input('1: Prewitt\n2: Roberts\n3: Laplacian of a Guassian(LoG)\n4: Canny\n5: Exit\n Enter your choice : ');
switch choice
case 1
PF=edge(f2,'prewitt');
figure, imshow(I),title('Original Image'),figure,imshow(PF),title('Prewitt Filter');
case 2
RF=edge(f2,'roberts');
figure, imshow(I),title('Original Image'),figure,imshow(RF),title('Roberts Filter');
case 3
LF=edge(f2,'log');
figure, imshow(I),title('Original Image'),figure,imshow(LF),title('Laplacian of Gaussian (LoG) Filter');
case 4
CF=edge(f2,'canny');
figure, imshow(I),title('Original Image'),figure,imshow(CF),title('Canny Filter');
case 5
display('the next operation');
otherwise
display('\nWrong Choice\n');
end
end
end
%%
k=input('type 1 if you want to know some pixels values OR 0 if no ','s')
if (k>='1')
vals = impixel(I)
end
%%
k=input('type 1 if you want to see imnage profile OR 0 if no ','s')
if (k>='1')
improfile
end
%%
k=input('type 1 if you want to see image contour OR 0 if no ','s')
if (k>='1')
imcontour(I,3)
end
%%
k=input('type 1 if you want image histogram OR 0 if no','s')
if (k>='1')
imhist(I)
end
%%