Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab 图像处理。寻找物体的中心_Matlab_Image Processing - Fatal编程技术网

Matlab 图像处理。寻找物体的中心

Matlab 图像处理。寻找物体的中心,matlab,image-processing,Matlab,Image Processing,我是MAT LAB的初学者。我试图在图像中找到物体的中心点,其中物体指的是圆、正方形、星形、三角形和五角大楼。有谁能帮我或指导我在编码中找到图像中上述对象的中心吗?是一个例子,它使用@Shai建议的regionprops,您必须使用功能regionprops,该功能测量图像中区域的属性,例如:区域的面积、周长,质心 我建议您检查第一个例子:计算质心并在图像上叠加位置。代码显示了如何计算包含文本的图像的不同区域(字母)的质心 % read image text.png BW = imread('t

我是MAT LAB的初学者。我试图在图像中找到物体的中心点,其中物体指的是圆、正方形、星形、三角形和五角大楼。有谁能帮我或指导我在编码中找到图像中上述对象的中心吗?

是一个例子,它使用@Shai建议的
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