Sometimes scale_by_pyclipper when called in datasets/utils/mask_refine.py line 73 is returning an array of lists instead of a matrix
hadillivvy opened this issue · 1 comments
hadillivvy commented
Sometimes the scale_by_pyclipper function returns a numpy array containing 2 lists of different sizes instead of a square matrix and this causes the error:
cv2.drawContours(mask_scaled, contour_scaled, -1, (255, 255, 255), -1)
cv2.error: OpenCV(4.7.0) :-1: error: (-5:Bad argument) in function 'drawContours'
> Overload resolution failed:
> - Can't parse 'contours'. Sequence item with index 0 has a wrong type
> - Can't parse 'contours'. Sequence item with index 0 has a wrong type
An example return of contour_scaled is a numpy array of size 2 with:
contour_scaled[0] being a list of size 751
contour_scaled[1] being a list of size 4
Would it be find to just disregard the smaller list?
cuteyyt commented
You can skip this contour_scale_size
directly if dilate is enough. This is just an option to expand the mask. However, sometimes, opencv may not recognize the expected contour, as you mentioned above.