ImageVerifierCode 换一换
格式:DOCX , 页数:21 ,大小:443.76KB ,
资源ID:6946391      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/6946391.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(机器视觉2.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

机器视觉2.docx

1、机器视觉2机器视觉与图像处理 实验报告学院名称 : 电气工程学院 专业班级 : 自动F1205 学生姓名 : 王国顺 学 号 : 201223911018 实验一实验内容:Matlab软件的使用1.打开MATLAB软件,了解菜单栏、工具栏、状态栏、命令窗口等;2.了解帮助文档help中演示内容demo有哪些;3.找到工具箱类里面的Image Processing工具箱,并进行初步学习,为后续实验做准备。实验步骤:实验二实验内容:图像的增强技术1.了解图像增强技术/方法的原理;2.利用matlab软件,以某一用途为例,实现图像的增强;3.通过程序的调试,初步了解图像处理命令的使用方法。实验步骤:

2、pout = imread(pout.tif);tire = imread(tire.tif);X map = imread(shadow.tif);shadow = ind2rgb(X,map); % convert to truecolorwidth = 210;images = pout, tire, shadow;for k = 1:3 dim = size(imagesk); imagesk = imresize(imagesk,width*dim(1)/dim(2) width,bicubic);Endpout = images1;tire = images2;shadow = i

3、mages3;pout_imadjust = imadjust(pout);pout_histeq = histeq(pout);pout_adapthisteq = adapthisteq(pout);imshow(pout);title(Original);figure, imshow(pout_imadjust);title(Imadjust);figure, imshow(pout_histeq);title(Histeq);figure, imshow(pout_adapthisteq);title(Adapthisteq); 实验三实验内容:图像特征提取1.了解图像特征提取的方法;

4、2.利用matlab软件,编程实现图像中长度、角度、半径、边界等特征的提取测量;3.通过程序的调试,初步了解图像特征提取命令的使用方法。实验步骤:1.load pendulum;immovie(frames);nFrames = size(frames,4);first_frame = frames(:,:,:,1);first_region = imcrop(first_frame,rect);frame_regions = repmat(uint8(0), size(first_region) nFrames);for count = 1:nFrames frame_regions(:,:

5、,:,count) = imcrop(frames(:,:,:,count),rect);endimmovie(frame_regions);seg_pend = false(size(first_region,1) size(first_region,2) nFrames);centroids = zeros(nFrames,2);se_disk = strel(disk,3);for count = 1:nFrames fr = frame_regions(:,:,:,count); imshow(fr) pause(0.2) gfr = rgb2gray(fr); gfr = imcom

6、plement(gfr); imshow(gfr) pause(0.2) bw = im2bw(gfr,.7); % threshold is determined experimentally bw = imopen(bw,se_disk); bw = imclearborder(bw); seg_pend(:,:,count) = bw; imshow(bw) pause(0.2)endfor count = 1:nFrames lab = bwlabel(seg_pend(:,:,count); property = regionprops(lab,Centroid); pend_cen

7、ters(count,:) = property.Centroid;endx = pend_centers(:,1);y = pend_centers(:,2);figureplot(x,y,m.), axis ij, axis equal, hold on;xlabel(x);ylabel(y);title(pendulum centers);abc = x y ones(length(x),1) -(x.2 + y.2);a = abc(1); b = abc(2); c = abc(3);xc = -a/2;yc = -b/2;circle_radius = sqrt(xc2 + yc2

8、) - c);pendulum_length = round(circle_radius)circle_theta = pi/3:0.01:pi*2/3;x_fit = circle_radius*cos(circle_theta)+xc;y_fit = circle_radius*sin(circle_theta)+yc;plot(x_fit,y_fit,b-);plot(xc,yc,bx,LineWidth,2);plot(xc x(1),yc y(1),b-);text(xc-110,yc+100,sprintf(pendulum length = %d pixels, pendulum

9、_length);实验结果: 2.RGB = imread(pillsetc.png);imshow(RGB);I = rgb2gray(RGB);threshold = graythresh(I);bw = im2bw(I,threshold);imshow(bw)% remove all object containing fewer than 30 pixelsbw = bwareaopen(bw,30);% fill a gap in the pens capse = strel(disk,2);bw = imclose(bw,se);% fill any holes, so that

10、 regionprops can be used to estimate% the area enclosed by each of the boundariesbw = imfill(bw,holes);imshow(bw)B,L = bwboundaries(bw,noholes);% Display the label matrix and draw each boundaryimshow(label2rgb(L, jet, .5 .5 .5)hold onfor k = 1:length(B) boundary = Bk; plot(boundary(:,2), boundary(:,

11、1), w, LineWidth, 2)endstats = regionprops(L,Area,Centroid);threshold = 0.94;% loop over the boundariesfor k = 1:length(B) % obtain (X,Y) boundary coordinates corresponding to label k boundary = Bk; % compute a simple estimate of the objects perimeter delta_sq = diff(boundary).2; perimeter = sum(sqr

12、t(sum(delta_sq,2); % obtain the area calculation corresponding to label k area = stats(k).Area; % compute the roundness metric metric = 4*pi*area/perimeter2; % display the results metric_string = sprintf(%2.2f,metric); % mark objects above the threshold with a black circle if metric threshold centro

13、id = stats(k).Centroid; plot(centroid(1),centroid(2),ko); end text(boundary(1,2)-35,boundary(1,1)+13,metric_string,Color,y,. FontSize,14,FontWeight,bold);endtitle(Metrics closer to 1 indicate that ,. the object is approximately round);实验结果: 3.RGB = imread(gantrycrane.png);imshow(RGB);text(size(RGB,2

14、),size(RGB,1)+15,Image courtesy of Jeff Mather,. FontSize,7,HorizontalAlignment,right);line(300 328,85 103,color,1 1 0);line(268 255,85 140,color,1 1 0);text(150,72,Measure the angle between these beams,Color,y,. FontWeight, bold);% you can obtain the coordinates of the rectangular region using% pix

15、el information displayed by imtoolstart_row = 34;start_col = 208;cropRGB = RGB(start_row:163, start_col:400, :);imshow(cropRGB)% Store (X,Y) offsets for later use; subtract 1 so that each offset will% correspond to the last pixel before the region of interestoffsetX = start_col-1;offsetY = start_row

16、-1;I = rgb2gray(cropRGB);threshold = graythresh(I);BW = im2bw(I,threshold);BW = BW; % complement the image (objects of interest must be white)imshow(BW)dim = size(BW);% horizontal beamcol1 = 4;row1 = min(find(BW(:,col1);% angled beamrow2 = 12;col2 = min(find(BW(row2,:);boundary1 = bwtraceboundary(BW

17、, row1, col1, N, 8, 70);% set the search direction to counterclockwise, in order to trace downward.boundary2 = bwtraceboundary(BW, row2, col2, E, 8, 90,counter);imshow(RGB); hold on;% apply offsets in order to draw in the original imageplot(offsetX+boundary1(:,2),offsetY+boundary1(:,1),g,LineWidth,2

18、);plot(offsetX+boundary2(:,2),offsetY+boundary2(:,1),g,LineWidth,2);实验结果: 4.RGB = imread(tape.png);imshow(RGB);text(15,15,Estimate radius of the roll of tape,. FontWeight,bold,Color,y);I = rgb2gray(RGB);threshold = graythresh(I);BW = im2bw(I,threshold);imshow(BW)dim = size(BW);col = round(dim(2)/2)-

19、90;row = find(BW(:,col), 1);connectivity = 8;num_points = 180;contour = bwtraceboundary(BW, row, col, N, connectivity, num_points);imshow(RGB);hold on;plot(contour(:,2),contour(:,1),g,LineWidth,2)x = contour(:,2);y = contour(:,1);% solve for parameters a, b, and c in the least-squares sense by% usin

20、g the backslash operatorabc = x y ones(length(x),1) -(x.2+y.2);a = abc(1); b = abc(2); c = abc(3);% calculate the location of the center and the radiusxc = -a/2;yc = -b/2;radius = sqrt(xc2+yc2)-c)% display the calculated centerplot(xc,yc,yx,LineWidth,2);% plot the entire circletheta = 0:0.01:2*pi;%

21、use parametric representation of the circle to obtain coordinates% of points on the circleXfit = radius*cos(theta) + xc;Yfit = radius*sin(theta) + yc;plot(Xfit, Yfit);message = sprintf(The estimated radius is %2.3f pixels, radius);text(15,15,message,Color,y,FontWeight,bold);实验结果: 实验四实验内容:图像变换1.了解图像变

22、换的原理;2.利用matlab软件,编程实现投影数据的图像重构;3.通过程序的调试,初步了解图像投影变换的应用。实验步骤:P = phantom(256);imshow(P)theta1 = 0:10:170;R1,xp = radon(P,theta1);num_angles_R1 = size(R1,2)theta3 = 0:2:178;R3,xp = radon(P,theta3);num_angles_R3 = size(R3,2)N_R1 = size(R1,1)N_R2 = size(R2,1)N_R3 = size(R3,1)P_128 = phantom(128);R_128,

23、xp_128 = radon(P_128,theta1);N_128 = size(R_128,1)figure, imagesc(theta3,xp,R3)colormap(hot)colorbarxlabel(Parallel Rotation Angle - theta (degrees);ylabel(Parallel Sensor Position - xprime (pixels);% Constrain the output size of each reconstruction to be the same as the% size of the original image,

24、 |P|.output_size = max(size(P);dtheta1 = theta1(2) - theta1(1);I1 = iradon(R1,dtheta1,output_size);figure, imshow(I1)dtheta2 = theta2(2) - theta2(1);I2 = iradon(R2,dtheta2,output_size);figure, imshow(I2)dtheta3 = theta3(2) - theta3(1);I3 = iradon(R3,dtheta3,output_size);figure, imshow(I3)D = 250;dse

25、nsor1 = 2;F1 = fanbeam(P,D,FanSensorSpacing,dsensor1);dsensor2 = 1;F2 = fanbeam(P,D,FanSensorSpacing,dsensor2);dsensor3 = 0.25;F3, sensor_pos3, fan_rot_angles3 = fanbeam(P,D,. FanSensorSpacing,dsensor3);figure, imagesc(fan_rot_angles3, sensor_pos3, F3)colormap(hot)colorbarxlabel(Fan Rotation Angle (

26、degrees)ylabel(Fan Sensor Position (degrees)Ifan1 = ifanbeam(F1,D,FanSensorSpacing,dsensor1,OutputSize,output_size);figure, imshow(Ifan1)Ifan2 = ifanbeam(F2,D,FanSensorSpacing,dsensor2,OutputSize,output_size);figure, imshow(Ifan2)Ifan3 = ifanbeam(F3,D,FanSensorSpacing,dsensor3,OutputSize,output_size

27、);figure, imshow(Ifan3)实验结果: 实验五实验内容:摄像机标定实验实验步骤:1 读取一幅画像并显示。2 检查内存中的画像。3 实现图像直方图均衡化4 读取图像中像素的坐标值5 保存图像6 检查新生成文件信息7 使用阈值操作将图像转换为二维图像8 根据RGB图像创建一幅灰度图像9 调节图像的对比度10 在同一个窗口内显示两幅图像11 掌握matlab命令及函数,获取标定块图像的特征点坐标12 根据摄像机标定方法原理,编写matlab程序,估计摄像机内参数和外参数实验总结 通过实验我学习掌握了许多知识,首先是对matlab有了一个全新的认识,了解了其在图像处理方面的巨大作用,对matlab的更多操作和命令的使用有了更高的掌握,最重要的事对matlab的处理能力有了一个更高的飞跃尤其是对相关函数的使用及相关问题的处理。相信在以后的学习和工作当中matlab将成为我非常有用的帮忙工具和好伙伴。

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1