关于质心提取的若干图像处理问题的总结.doc

关于质心提取的若干图像处理问题的总结.doc

  1. 1、本文档共5页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
关于质心提取的若干图像处理问题的总结

关于质心提取的若干图像处理问题的总结 1.提取多个目标物的质心位置 I = imread(test.png);%加载图图像 I1 = im2bw(I); L = bwlabel(I1);%将I1转换为标记矩阵 stats = regionprops(L, Centroid);%求质心 imshow(I) hold on; for i = 1 : length(stats) temp = stats(i).Centroid; plot(temp(1), temp(2), r.); end 2提取一个车轮的中心 clear all;clc rgb = imread(wheel.jpg); I=rgb2gray(rgb); Ibw=im2bw(I); Ibw=imclearborder(Ibw); Ibw=bwmorph(Ibw,close,2); Ibw=imfill(Ibw,holes); Ibw=bwmorph(Ibw,open,2); imshow(rgb) [l,m]=bwlabel(Ibw,8); stats=regionprops(l,Centroid); hold on; plot(stats(1).Centroid(1),stats(1).Centroid(2),R+); hold off 3提取两个车轮的中心,并计算他们之间的距离 clear all; close all clc rgb = imread(wheel1.jpg); I=rgb2gray(rgb); Ibw=im2bw(I); Ibw=imclearborder(Ibw); Ibw=bwmorph(Ibw,close,2); Ibw=imfill(Ibw,holes); Ibw=bwareaopen(Ibw,500); imshow(rgb,notruesize) %figure,imshow(Ibw); [l,m]=bwlabel(Ibw,8); hold on; for i=1:m stats=regionprops(l,Centroid); plot(stats(i).Centroid(1),stats(i).Centroid(2),R+); end a=stats(1).Centroid(1); b=stats(1).Centroid(2); c=stats(2).Centroid(1); d=stats(2).Centroid(2); sd=sqrt((a-c)^2+(b-d)^2); title(strcat(两个车轮的距离为:,num2str(sd))); hold off 4.求两个同心圆的半径差 clear close all clc RGB=imread(yuan.jpg);%读入图像 I = rgb2gray(RGB); threshold = graythresh(I); BW = im2bw(I,threshold); dim = size(BW); col = round(dim(2)/2); row = min(find(BW(:,col))); connectivity = 8; num_points = 180; contour = bwtraceboundary(BW, [row, col], N, connectivity, num_points); % imshow(RGB,notruesize); % hold on; %plot(contour(:,2),contour(:,1),g,LineWidth,2); x = contour(:,2); y = contour(:,1); 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; radius1 = sqrt((xc^2+yc^2)-c) %figure img4=BW(15:170,15:170); img4=imclearborder(img4,8); imshow(img4) dim = size(img4); col = round(dim(2)/2); row = min(find(img4(:,col))); connectivity = 8; num_points = 180; contour = bwtraceboundary(img4, [row, col], N, connectivity, num_points); % imshow(img4,notruesize); % hold on; % plot(contour(:,2),co

文档评论(0)

xcs88858 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8130065136000003

1亿VIP精品文档

相关文档