matlab图像处理基础实例 联系客服

发布时间 : 星期二 文章matlab图像处理基础实例更新完毕开始阅读4f97b806a6c30c2259019e94

注意:找不到wiener函数

>> i=imread('eight.tif'); >> i=double(i); >> imshow(i,[])

>> h=[0 1 0;1 -4 0;0 1 0]; >> j=conv2(i,h,'same'); >> k=i-j; >> hold

Current plot held >> figure

>> imshow(k,[])

i=imread('eight.tif');

>> subplot(211),imshow(i),title('pri')

>> H=fspecial('laplacian');%应用laplacian滤波进行图像锐化 >> laplacianH=filter2(H,i);%在5*5邻域内进行维纳滤波 >> subplot(223),imshow(laplacianH) >> title('laplacian算子锐化图像') >> H=fspecial('prewitt'); >> prewittH=filter2(H,i);

>> subplot(224),imshow(prewittH) >> title('prewitt模板锐化图像')

>> i=imread('saturn.png'); >> j=imnoise(i,'salt',.02);

>> subplot(121),imshow(j),title('含噪图片') >> j=double(j);f=fft2(j); >> g=fftshift(f); >> [m,n]=size(f); >> n=3;d0=20;

>> n1=floor(m/2);n2=floor(n/2); >> for i=1:m for j=1:n

d=sqrt((i-n1)^2+(j-n2)^2);h=1/(1+.414*(d/d0)^(2*n)); g(i,j)=h*g(i,j); end end

>> g=ifftshift(g);

>> g=uint8(real(ifft2(g))); >> subplot(122),imshow(g)

>> title('三阶巴特沃斯滤波结果')

>> rgb=imread('peppers.png');

>> subplot(221),imshow(rgb),title('pri')

>> subplot(222),imshow(rgb(:,:,1)),title('red part') >> subplot(223),imshow(rgb(:,:,2)),title('green part') >> subplot(224),imshow(rgb(:,:,3)),title('blue part')