Reporte de actividades del proyecto de Investigación en ...
Reporte de actividades del proyecto de Investigación en ...
Reporte de actividades del proyecto de Investigación en ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
im=double(im);<br />
[ancho largo]=size(im)<br />
for x=2:1:ancho-1<br />
for y=2:1:largo-1<br />
a=im(x-1,y-1);b=im(x,y-1);c=im(x+1,y-1);d=im(x-1,y);e=im(x,y);<br />
f=im(x+1,y); g=im(x-1,y+1);h=im(x,y+1);i=im(x+1,y+1);<br />
a=double(a);b=double(b);c=double(c);d=double(d);e=double(e);<br />
f=double(f);g=double(g);h=double(h);i=double(i);<br />
Roberts(x,y)=abs(e-a)+abs(b-d);<br />
SobelM1=a*(-1)+d*(-2)+g*(-1)+c+f*2+i;<br />
SobelM2=a*(-1)+b*(-2)+c*(-1)+g+h*2+i;<br />
valores(1:2)=[SobelM1 SobelM2];<br />
Sobel(x,y)=uint8(max(valores));<br />
PrewittM1=a*(-1)+b*(-1)+c*(-1)+g+h+i;<br />
PrewittM2=c*(-1)+f*(-1)+i*(-1)+a+d+g;<br />
valores(1:2)=[PrewittM1 PrewittM2];<br />
Prewitt(x,y)=uint8(max(valores));<br />
KirchM1=a*(+5)+b*(+5)+c*(+5)+d*(-3)+f*(-3)+g*(-3)+h*(-3)+i*(-3);<br />
KirchM2=a*(-3)+b*(+5)+c*(+5)+d*(-3)+f*(+5)+g*(-3)+h*(-3)+i*(-3);<br />
KirchM3=a*(-3)+b*(-3)+c*(+5)+d*(-3)+f*(+5)+g*(-3)+h*(-3)+i*(+5);<br />
KirchM4=a*(-3)+b*(-3)+c*(-3)+d*(-3)+f*(+5)+g*(-3)+h*(+5)+i*(+5);<br />
KirchM5=a*(-3)+b*(-3)+c*(-3)+d*(-3)+f*(-3)+g*(+5)+h*(+5)+i*(+5);<br />
KirchM6=a*(-3)+b*(-3)+c*(-3)+d*(+5)+f*(-3)+g*(+5)+h*(+5)+i*(-3);<br />
KirchM7=a*(+5)+b*(-3)+c*(-3)+d*(+5)+f*(-3)+g*(+5)+h*(-3)+i*(-3);<br />
KirchM8=a*(+5)+b*(+5)+c*(-3)+d*(+5)+f*(-3)+g*(-3)+h*(-3)+i*(-3);<br />
valores(1:8)=[KirchM1 KirchM2 KirchM3 KirchM4 KirchM5 KirchM6 KirchM7<br />
KirchM8];<br />
Kirch(x,y)=uint8(max(valores));<br />
LaplacianoM1(x,y)=b*(-1)+d*(-1)+e*(4)+f*(-1)+h*(-1);<br />
LaplacianoM2(x,y)=a+b*(-2)+c+d*(-2)+e*(4)+f*(-2)+g+h*(-2)+i;<br />
LaplacianoM3(x,y)=a*(-1)+b*(-1)+c*(-1)+d*(-1)+e*(8)+f*(-1)+g*(-1)+h*(-1)+i*(-1);<br />
<strong>en</strong>d<br />
<strong>en</strong>d<br />
figure, imshow(im) ; title('Original');<br />
figure, imshow(Roberts);title('Roberts');<br />
figure, imshow(Sobel);title('Sobel');<br />
figure, imshow(Prewitt);title('Prewitt');<br />
figure, imshow(Kirch);title('Kirch');<br />
figure, imshow(LaplacianoM1);title('Laplaciano a');<br />
figure, imshow(LaplacianoM2);title('Laplaciano b');<br />
figure, imshow(LaplacianoM3);title('Laplaciano c');<br />
Programa #7: Detección <strong>de</strong> contornos<br />
96