1

I am trying to preprocess my image so that in the end i could find the contours from the preprocessed image.

img = cv2.imread('image.jpg',0)
img = cv2.copyMakeBorder(img, 50, 50, 50, 50, cv2.BORDER_CONSTANT)   
sobely = cv2.Sobel(img,cv2.CV_64F,0,1,ksize=5)
_,contours, hierarchy = cv2.findContours(sobely,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)

It is giving me an error stating : OpenCV Error: 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 cvStartFindContours

I am usng opencv3.0

1 Answer 1

2

Pretty straight forward. Your image should be of ideally binary and CV_8UC1. You will have to convert the image to CV_8UC1 format to enable contours to be processed. Contours does not support CV_64F double type.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.