7.a. Straight Bounding Rectangle
It is a straight rectangle, it doesn't consider the rotation of the object. So area of the bounding rectangle won't be minimum. It is found by the function cv2.boundingRect().
Let (x,y) be the top-left coordinate of the rectangle and (w,h) be its width and height. @code{.py} x,y,w,h = cv2.boundingRect(cnt) cv2.rectangle(img,(x,y),(x+w,y+h),(0,255,0),2) @endcode
根据OpenCV文档,findContours使用“Suzuki, S. and Abe, K., Topological Structural Analysis of Digitized Binary Images by Border Following”
我没有找到boundingRect算法的描述,但找到了this file in opencv repo
所以boundingRect似乎只找到输入点集的最小和最大坐标
抱歉,我的英语很差
相关问题 更多 >
编程相关推荐