Hi Folks,
I'm beginning with open-cv using the python bindings. I'm trying to do a simple proof-of-concept code to detect horizontal lines in images.
For that I'm trying a threshold manipulation plus a HoughLinesP transform to detect lines but cv2.HoughLinesP complains that the image is not 8-bit single channel.
retval, thresh = cv2.threshold(img_filtered, 254, 255, cv2.THRESH_BINARY_INV)
lines = cv2.HoughLinesP(thresh, 1, np.pi/180, 200, 800, 0)
>> error: (-5) The source image must be 8-bit, single-channel in function cvHoughLines2
I'm pretty sure the image is being loaded as grayscale (I tried two different approaches for this):
img = cv2.imread("source.jpg", 0)
gray = cv2.cvtColor (img, cv2.COLOR_BGR2GRAY)
What am I doing wrong here? What should I do to pass the output of cv2.threshold int cv2.HoughLinesP?
Thanks in advance,