OpenCV(4.6.0) cv2.fillPoly throws an error -

Viewed 17

epoch = 0 #putting the contours of the broken rice grain filled in white on the black background and saving it in the given address

for j in broken_cnt:
for i in range(0, len(j)):
bg_copy = bg.copy()
cnt_scaled = scale_contour(j[i], 10)
 cv2.fillPoly(bg_copy, pts =[cnt_scaled], color=(255,255,255)) #filling in the contours with white
cv2.imwrite(r'C:\Users\mrsks\Downloads\Akaike Technologies_ Computer Vision Assignment\data\train\broken_train\broken_%04d.png'%(epoch+1), bg_copy)
epoch+=1

error: OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\drawing.cpp:2396: error: (-215:Assertion failed) p.checkVector(2, CV_32S) >= 0 in function 'cv::fillPoly'

0 Answers
Related