计算机视觉技术的基本应用实验报告,计算机视觉实验5形态学滤波实验报告

a7f4a3f590493a1e451dd952a488fd7c.gif 计算机视觉实验5形态学滤波实验报告

(6页)

da754835bb4a233086a3dadea6347774.gif

本资源提供全文预览,点击全文预览即可全文预览,如果喜欢文档就下载吧,查找使用更方便哦!

19.90 积分

Experiment 4:Thresholding ⅱ.You need to review Matlab programming language and M-file format.ⅲ. You should have studied image segmentation and mathematical morphology methods.ⅢⅢ. Experiment Contentsⅰ.Read “bac.bmp” file (to do this by imread function), convert the color image into grayscale image, and then perform thresholding by auto threshoding method using “while loop” and display the results in a Matlab window. 程序:%Iterative thresholdiclear all;im=imread('bac.bmp');subplot(1,2,1);imshow(im);title('Gray image');[Y X]=size(im);S=sum(sum(im));S=S/(X*Y);D=0.1;T=0;im_bi=imS;while(abs(S-T)D)im1=double(im_bi).*double(im);im2=double(abs(1-im_bi)).*double(im);S1=sum(sum(im1))/sum(sum(im_bi));S2=sum(sum(im2))/sum(sum(abs(1-im_bi)));T=S;S=(S1+S2)/2;im_bi=imS;endsubplot(1,2,2);imshow( im_bi);title('image after Auto_thresholding');ⅱ. Read “bw_bac.bmp” file and “bw_bac2.bmp”(to do this by imread function), perform mathematical morphology to fill the small holes in objects and display the results in a Matlab window.腐蚀:mask=[1 1 1;1 1 1;1 1 1];im=imread('bw_bac.bmp');figure(1)subplot(1,2,1);imagesc(im);colormap(gray);[Y,X]=size(im);im_new=zeros(Y,X);T=sum(sum(mask));for kk=2:Y-1for k=2:X-1%Calculating sigmaimblock=im(k-1:k+1,kk-1:kk+1);sigma=sum(sum(imblockif sigma 0im_new(i,j)=1;elseim_new(i,j)=im(i,j);endendendsubplot(1,2,2)imagesc(im_new);colormap(gray);iii. Read “Plate.jpg” file, convert the color image into gray scale image, then perform thresholding I=imread('Plate.JPG'); im=rgb2gray(I);subplot(3,2,1);imshow(im); title('Gray image');[Y X]=size(im);S=sum(sum(im));S=S/(X*Y);D=0.1;T=0;im_bi=imS;while(abs(S-T)D)im1=double(im_bi).*double(im);im2=double(abs(1-im_bi)).*double(im);S1=sum(sum(im1))/sum(sum(im_bi));S2=sum(sum(im2))/sum(sum(abs(1-im_bi)));T=S;S=(S1+S2)/2;im_bi=imS;endsubplot(3,2,2);imshow( im_bi);title('image after Auto_thresholding');mask=[1 1 1;1 1 1;1 1 1];im_new=zeros(Y,X);T=sum(sum(mask));for kk=2:X-1for k=2:Y-1 imblock=im_bi(k-1:k+1,kk-1:kk+1);sigma=sum(sum(imblock if sigma 0im_new(i,j)=1;elseim_new(i,j)=new(i,j);endendendsubplot(3,2,4)imagesc(im_new);colormap(gray);title('image after open'); 关 键 词: 计算机 视觉 实验 形态学 滤波 报告

4d91c43bfc72ca913299809b07b4968f.gif  天天文库所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值