如何获得目标连接组件的边界椭圆 [英] How to obtain the bounding ellipse of a target connect component
问题描述
假设我们有图像中的连接组件如下图所示: 。 P>
我的问题是如何计算的连接组件的边界椭圆(红色椭圆形的形象)。我已经检查了MATLAB函数 regionprops 和理解MATLAB能怎么办那。我还注意到,OpenCV的类似功能做到这一点 CBlob :: GetEllipse()。不过,虽然我知道他们是如何通过阅读code获得的结果,其背后的基本理论仍然不清楚我。因此,我想知道是否有一定的标准算法来完成这项工作。谢谢!
编辑:
根据该意见,我重组我的问题:在图像一刻维基百科中的计算公式最长的轴的角度为
然而,在MATLAB函数 regionprops 时,所述codeS如下:
%计算方向。
如果(uyy> UXX)
NUM = uyy - UXX +开方((uyy - UXX)^ 2 + 4 * UXY ^ 2);
书房= 2 * UXY;
其他
NUM = 2 * UXY;
书房= UXX - uyy +开方((UXX - uyy)^ 2 + 4 * UXY ^ 2);
结束
此实现是与式Wikipedia中不一致。我想知道哪一个是正确的。
我试图找出什么是它背后的算法,以及让我可以写我自己的实现它。我发现它在MathWorks公司的博客文章。在意见之一,作者说:
regionprops计算所讨论的对象的第二次矩,然后返回椭圆的测量结果与相同第二次矩
和后来的后来:
给出的公式是由Haralick和夏皮罗,计算机和机器人视觉体积。 1,附录A,艾迪生韦斯利1992年我做了一个全面的检查通过构建包含与长轴长度为100和短轴长度= 50,和regionprops椭圆图像返回正确的测量结果。
我没有这方面的书,但看来我需要得到它的副本。
Suppose we have a connected component in the image as the following image illustrates:.
My question is how can calculate the bounding ellipse of the connected components (the red ellipse in the image). I have checked MATLAB function regionprops, and understand how MATLAB can do that. I also notice that Opencv has similar function to do that CBlob::GetEllipse(). However, although I understand how they obtain the result by reading the code, the fundamental theory behind it is still unclear to me. I am therefore wondering whether there are some standard algorithms to do the job. Thanks!
EDIT:
Based on the comments, I reorganized my question: in image moment Wikipedia the calculation formula of the longest axis angle is
However, in the MATLAB function regionprops, the codes are as follows:
% Calculate orientation.
if (uyy > uxx)
num = uyy - uxx + sqrt((uyy - uxx)^2 + 4*uxy^2);
den = 2*uxy;
else
num = 2*uxy;
den = uxx - uyy + sqrt((uxx - uyy)^2 + 4*uxy^2);
end
This implementation is inconsistent with the formula in Wikipedia. I was wondering which one is correct.
I was trying to find out what's the algorithm behind it as well so I could write my own implementation of it. I found it on a blog post of mathworks. In one of the comments, the author says:
regionprops calculates the 2nd-order moments of the object in question and then returns measurements of the ellipse with the same 2nd-order moments.
and later later:
The equations used are from Haralick and Shapiro, Computer and Robot Vision vol. 1, Appendix A, Addison-Wesley 1992. I did a sanity check by constructing an image containing an ellipse with major axis length = 100 and minor axis length = 50, and regionprops returned the correct measurements.
I don't have that book but seems I'll need to get a copy of it.
这篇关于如何获得目标连接组件的边界椭圆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!