Reputation: 1920
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
Upvotes: 1
Views: 2172
Reputation: 458
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.
Upvotes: 2