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