-1

I have a image that processed to find edges with canny edges algorithm, now i need to draw bounding boxes around this shapes. The problem is that when i use

cv2.findContours

i get this error

error: OpenCV(4.1.2) /io/opencv/modules/imgproc/src/contours.cpp:197: 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 image is the shape of a pig. enter image description here

How can i accomplish this?

TTT2
  • 549
  • 2
  • 13
  • 1
    Convert your image to uint8. It is likely floats and that won't work with findContours – fmw42 Oct 15 '21 at 03:35

1 Answers1

0

Need more information about your situation, but it looks like you have to convert your image before using that function. like

image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
image = image.astype("uint8")

try execute this code before using that function.

TaekYoung
  • 45
  • 7