I= imread('E:\matlab\work\1.png'); %读取图片 i=im2double(I); J=imread('E:\matlab\work\2.png'); j=im2double(J); p=i-j; P=p*255; imshow(P,[]);
1.png:
2.png
效果:
</pre><pre name="code" class="plain">j=zeros(366,572); i=imread('E:\matlab\work\cancer.bmp'); i=double(i); a=0;b=0; for m=1:365 for n=1:571 a=i(m,n)-i(m+1,n); b=i(m,n)-i(m,n+1); a=abs(a);b=abs(b); if a>b j(m,n)=a; else j(m,n)=b; end if j(m,n)>3 j(m,n)=0; else j(m,n)=255; end end end imshow(j,[0 255]);
原文地址:http://blog.csdn.net/u012422829/article/details/45745125