Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.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 imfindcircles不';在我的bw图像中不起作用_Matlab_Image Processing - Fatal编程技术网

MatLab imfindcircles不';在我的bw图像中不起作用

MatLab imfindcircles不';在我的bw图像中不起作用,matlab,image-processing,Matlab,Image Processing,我使用Matlab中的bwlabel生成bw图像并对其进行标记(附图),我想使用imfindcircles查找bw图像中的圆形对象。但是imfindcircles没有找到正确的圆(在白色对象上)。有人知道为什么以及如何修复它吗?谢谢大家! 这对我来说很有用: Irgb=imread('z:/ww5l8.jpg'); Igray=mean(double(Irgb)/255,3); Ibw=Igray>0.5; [centers,radii]=imfindcircles(Ibw,[6,80]

我使用Matlab中的
bwlabel
生成bw图像并对其进行标记(附图),我想使用
imfindcircles
查找bw图像中的圆形对象。但是
imfindcircles
没有找到正确的圆(在白色对象上)。有人知道为什么以及如何修复它吗?谢谢大家!

这对我来说很有用:

Irgb=imread('z:/ww5l8.jpg');
Igray=mean(double(Irgb)/255,3);
Ibw=Igray>0.5;

[centers,radii]=imfindcircles(Ibw,[6,80],'ObjectPolarity','bright');
fprintf('Found %d circles\n',size(centers,1));
figure(1); imshow(Ibw); hold on;
plot(centers(:,1),centers(:,2),'b*'); hold off;
更好的选择是使用区域属性进行过滤:

stats = regionprops(Ibw,{'Centroid','Eccentricity'})
Centroid=vertcat(stats.Centroid)
Eccentricity=vertcat(stats.Eccentricity)

以什么方式不起作用-你能更详细地描述你的错误并发布你正在使用的代码吗?非常感谢!请问Igray=double(Irgb)/255,3的意思是什么平均值?这是一种将rgb(3个平面)-uint8(0-255)转换为灰色(1个平面)-double(0-1)的方法。使用uint8进行计算时必须小心。对2个uint8数字求和时,最大值为255。平均的计算结果是错误的。啊,谢谢!那我就不明白了。为什么我们需要将黑白图像转换为灰度图像才能找到圆,而且效果更好?我的意思是bw图像是否应该比灰度图像更好,因为它只有0和255?我以jpg格式下载了它。另一件有趣的事情是:识别图像组件,边缘检测它们,并在每个组件的边缘上做一个实际的圆拟合。Ian Coope对最后一部分有一个非常好的算法。