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

上传人:工**** 文档编号:459683882 上传时间:2022-11-15 格式:DOCX 页数:4 大小:37.31KB
返回 下载 相关 举报
关于质心提取的若干图像处理问题的总结_第1页
第1页 / 共4页
关于质心提取的若干图像处理问题的总结_第2页
第2页 / 共4页
关于质心提取的若干图像处理问题的总结_第3页
第3页 / 共4页
关于质心提取的若干图像处理问题的总结_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

《关于质心提取的若干图像处理问题的总结》由会员分享,可在线阅读,更多相关《关于质心提取的若干图像处理问题的总结(4页珍藏版)》请在金锄头文库上搜索。

1、关于质心提取的若干图像处理问题的总结关于质心提取的若干图像处理问题的总结 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 = imrea

2、d(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提取两个车轮的中心,并计算他们之间的距离 cl

3、ear 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(sta

4、ts(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

5、 = 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

6、 = 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(xc2+yc2)-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); c

7、onnectivity = 8; num_points = 180; contour = bwtraceboundary(img4, row, col, N, connectivity, num_points); % imshow(img4,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

8、); xc = -a/2; yc = -b/2; radius2 = sqrt(xc2+yc2)-c) imshow(RGB) message = sprintf(The estimated radius of big circle is %2.3f pixels, radius1); text(15,15,message,Color,y,FontWeight,bold); title(大圆) message = sprintf(The estimated radius of small circle is %2.3f pixels, radius2); text(25,25,message,

9、Color,y,FontWeight,bold); title(小圆) distance=radius1-radius2 message = sprintf(The estimated distance of two circle is %2.3f pixels, distance); text(90,45,message,Color,y,FontWeight,bold); 5. 求桃形物体最宽的部分的宽度 img=imread(seed.jpg); img=rgb2gray(img); img=im2bw(img); img1=img; m n=find(img1=1); max(m)-min(m); ans = 369

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 建筑/环境 > 施工组织

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号