cv2.error: Unsupported format or combination of formats
Closed this issue · 1 comments
Hi,
I'm facing difficulties when attempting to provide images to the "patch_based_inpainting.inpaint.Inpaint(...)" object. I'm encountering the following error message:
cv2.error: OpenCV(4.8.1) /io/opencv/modules/imgproc/src/contours.cpp:195: error: (-210:Unsupported format or combination of formats) [Start]FindContours supports only CV_8UC1 images when mode != CV_RETR_FLOODFILL otherwise supports CV_32SC1 images only in function 'cvStartFindContours_Impl'
The .png images that I use are 512 x 512 pixels in size and only contain binary values (0 and 255). The same also applies for the masks that I use. For the reading of the images, I use the "cv2.imread(...)" functionality. I use a patch_size of 10 and an overlap of 3.
Do you have an Idea what could be the cause of the problem?
Thank you in advance for your assistance!
Most probably the mask is not in CV_8UC1, use array = array.astype(np.uint8)
to convert it in the right format.