User talk:Rafif03

1. Simulation and Display of an Image, Negative of an Image(Binary & Gray Scale) 2 % Red Blue and Green and Gray Components i=imread('cancercell.jpg'); subplot(3,2,1); imshow(i); title('Original Image'); %Red Component r=i(:,:,1); subplot(3,2,2); imshow(r);title('Red Component'); %Green Component g=i(:,:,2); subplot(3,2,3); imshow(g); title('Green Component'); %Blue Component b=i(:,:,3); subplot(3,2,4); imshow(b); title('Blue Component'); %Color to Gray Image rg=rgb2gray(i); subplot(3,2,5); imshow(rg); title('Gray Image'); —————————————- Display color Image, find its complement and convert to gray scale I=imread('cancercell.jpg'); subplot(2,2,1); imshow(I); subimage(I); title('Color Image'); c=imcomplement(I); subplot(2,2,2); imshow(c); subimage(c); title('Complement of color Image'); r=rgb2gray(I); subplot(2,2,3); imshow(r); subimage(r); title('Gray scale of color Image'); %Complement of Gray Image b=imcomplement(r); subplot(2,2,4); imshow(b); subimage(b); title('Complement of Gray Image'); %Simulation of an Image( Arithmetic & Logic Operation) a=ones(40); b=zeros(40); c=[a b;b a]; d=[b b;a a]; A=10*(c+d); M=c.*d; S=c-d; D=c/4; figure; subplot(3,2,1); imshow(c); subplot(3,2,2); imshow(d); subplot(3,2,3); imshow(A); subplot(3,2,4); imshow(M); subplot(3,2,5); imshow(S); subplot(3,2,6); imshow(D); ————————————————- Implementation of Relationships between Pixels Neighbour of 4,8 and Diagonal point % To find Neighbour of a given Pixel a=magic(5); disp(‘a=’); disp(a); b=input('Enter the row < size of the Matrix'); c=input(' Enter the Column < size of matrix'); disp(‘Element’); disp(a(b,c)); % 4 Point Neighbour N4=[a(b+1,c), a(b-1,c), a(b,c+1), a(b,c-1)]; disp(‘N4=’); disp(N4); %8 Point Neighbour N8=[a(b+1,c), a(b-1,c), a(b,c+1), a(b,c-1), a(b+1,c+1), a(b+1,c-1), a(b-1,c-1), a(b-1,c+1)]; disp(‘N8=’); disp(N8); %Diagonal Neighbour ND=[ a(b+1,c+1), a(b+1,c-1), a(b-1,c-1), a(b-1,c+1)]; disp(‘ND=’); disp(ND); Output a= 17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9 Enter the row < size of the Matrix 3 Enter the Column < size of matrix 3 Element = 13 N4= 19 7 20 6 N8= 19 7 20 6 21 12 5 14 ND= 21 12 5 14