Matlab 图像处理。寻找物体的中心
我是MAT LAB的初学者。我试图在图像中找到物体的中心点,其中物体指的是圆、正方形、星形、三角形和五角大楼。有谁能帮我或指导我在编码中找到图像中上述对象的中心吗?是一个例子,它使用@Shai建议的Matlab 图像处理。寻找物体的中心,matlab,image-processing,Matlab,Image Processing,我是MAT LAB的初学者。我试图在图像中找到物体的中心点,其中物体指的是圆、正方形、星形、三角形和五角大楼。有谁能帮我或指导我在编码中找到图像中上述对象的中心吗?是一个例子,它使用@Shai建议的regionprops,您必须使用功能regionprops,该功能测量图像中区域的属性,例如:区域的面积、周长,质心 我建议您检查第一个例子:计算质心并在图像上叠加位置。代码显示了如何计算包含文本的图像的不同区域(字母)的质心 % read image text.png BW = imread('t
regionprops
,您必须使用功能regionprops
,该功能测量图像中区域的属性,例如:区域的面积、周长,质心
我建议您检查第一个例子:计算质心并在图像上叠加位置。代码显示了如何计算包含文本的图像的不同区域(字母)的质心
% read image text.png
BW = imread('text.png');
%Calculate centroids for connected components in the image using regionprops.
s = regionprops(BW,'centroid');
%Concatenate structure array containing centroids into a single matrix.
centroids = cat(1, s.Centroid);
% Display binary image with centroid locations superimposed.
imshow(BW)
hold on
plot(centroids(:,1),centroids(:,2), 'b*')
hold off