美文网首页
cv2.fillPoly() & cv.fillConvexPo

cv2.fillPoly() & cv.fillConvexPo

作者: 红缕鱼与绿缕鱼与驴 | 来源:发表于2018-10-31 15:25 被阅读0次

cv2.fillPoly and cv2.fillConvexPoly use different data types for their point arrays, because fillConvexPoly draws only one polygon and fillPoly draws a (python) list of them. Thus,

cv2.fillConvexPoly(ar, triangle, 1)
cv2.fillPoly(ar, [triangle], 1)
are the correct ways to call these two methods. If you had square and hexagon point arrays, you could use

cv2.fillPoly(ar, [triangle, square, hexagon], 1)
and triangle, square, hexagon are all lists of points like [(0,100),(0,self.shape[0]),(self.shape[1],self.shape[0]),(self.shape[1],100)]
to draw all three.

As for the dtype of the second augment of fillPoly() ,we shoule use np.int32

相关文章

网友评论

      本文标题:cv2.fillPoly() & cv.fillConvexPo

      本文链接:https://www.haomeiwen.com/subject/ogyatqtx.html