700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > MatLab 数字图像处理实验 图像分割

MatLab 数字图像处理实验 图像分割

时间:2024-05-27 11:36:47

相关推荐

MatLab 数字图像处理实验 图像分割

实验(1)以chair.jpg图像为例,分别采用sobel、prewitt、robertslog对该图像及其加上噪声后的图像进行边缘检测。

close allclear allI=imread('D:/chair.jpg');I_noise=imnoise(I,'gaussian',0.06);bw1=edge(I_noise,'sobel');bw2=edge(I_noise,'prewitt');bw3=edge(I_noise,'roberts');bw4=edge(I_noise,'log',[],4);subplot(2,3,1);imshow(I);xlabel('原图');subplot(2,3,2);imshow(I_noise,[]);xlabel('加入高斯噪声后的图像'); subplot(2,3,3);imshow(bw1);xlabel('Sober算子'); subplot(2,3,4);imshow(bw2);xlabel('Prewitt算子'); subplot(2,3,5);imshow(bw3);xlabel('Robrtts算子'); subplot(2,3,5);imshow(bw4);xlabel('LoG算子');

实验(2)以cell.jpg图像为例,分别迭代式阈值选择法最大类间方差阈值选择法对该图像进行分割。

clcclose allclear allI=imread('D:/cell.jpg');I=im2double(I);[width.heoght]=size(I)T1=graythresh(I);BW1=im2bw(I,T1);f=double(I);T=(min(f(:))+max(f(:)))/2;done=false;i=0;while~doner1=find(f<=T);r2=find(f>T);Tnew=(mean(f(r1))+mean(f(r2)))/2done=abs(Tnew-T)<1T=Tnew;i=i+1;endf(r1)=0;f(r2)=1;subplot(1,3,1);imshow(I);xlabel('原图');subplot(1,3,2);imshow(f);xlabel('迭代式阈值选择法');subplot(1,3,3);imshow(BW1);xlabel('Otsu算法');

参考:/uchihalyn/article/details/104593878

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。