C++ 了解 opencv 中的矩函数

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22470902/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 00:05:39  来源:igfitidea点击:

Understanding Moments function in opencv

c++opencv

提问by Steph

When finding the center coordinates using moments in OpenCV,the point is found using

在 OpenCV 中使用矩求中心坐标时,使用

Point(moment[i].m10/moment[i].m00,moment[i].m01/moment[i].m00);

Can somebody please explain this bit to me?What do "m10","m00","m01" and "m00" mean??

有人可以向我解释一下吗?“m10”、“m00”、“m01”和“m00”是什么意思?

回答by Michael Burdinov

Definition of moments in image processing is borrowed from physics. Assume that each pixel in image has weight that is equal to its intensity. Then the point you defined is centroid (a.k.a. center of mass) of image.

图像处理中矩的定义是从物理学中借来的。假设图像中的每个像素的权重等于其强度。然后您定义的点是图像的质心(又名质心)。

Assume that I(x,y) is the intensity of pixel (x,y) in image. Then m(i,j) is the sum for all possible x and y of: I(x,y) * (x^i) * (y^j).

假设 I(x,y) 是图像中像素 (x,y) 的强度。然后 m(i,j) 是所有可能的 x 和 y 的总和:I(x,y) * (x^i) * (y^j)。

Hereyou can read the documentation of moments used in OpenCV. They are called raw moments.

在这里您可以阅读 OpenCV 中使用的矩的文档。它们被称为原始时刻。

And hereyou can read a wiki article about all kinds of image moments (raw moments, central moments, scale/rotation invariant moments and so on). It is pretty good one and I recommend reading it.

在这里你可以看到各种图像矩(原时刻,中心矩,规模/旋转不变矩等)维基文章。这是相当不错的一本,我建议阅读它。