OpenCV 2.3中的Mat(逻辑)运算符'> =' [英] Mat (logic) operator '>=' in OpenCV 2.3
问题描述
我从OpenCV 2.3运行了一个演示代码distrans.cpp,其中有几行代码我几乎不知道这是什么意思:
I run a demo code from OpenCV 2.3, distrans.cpp and there is a line of code I barely figure out what it means:
Mat edge = gray >= edgeThresh, dist, labels, dist8u;
它的使用类似于阈值操作,但我不知道它是如何工作的,甚至不知道&用谷歌搜索.
It is used like a thresholding operation but I don't know how it works or even to name & google it.
谢谢
推荐答案
operator >=
cv :: Mat的重载将操作映射到
operator >=
overload for cv::Mat maps the operation to call to cv::compare
with the relevant comparison key.
cv::compare
函数返回一个掩码(深度为CV_8U
的cv::Mat
),其中所有满足条件的元素(如果gray
的元素的值不小于edgeThresh
)被设置为0xFF
,其他元素为零.
The cv::compare
function returns a mask (cv::Mat
of CV_8U
depth) where all elements satisfying the condition (if element of gray
has a value not less than edgeThresh
in your case) are set to 0xFF
and the other elements are zero.
这篇关于OpenCV 2.3中的Mat(逻辑)运算符'> ='的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!