1 | initial version |
threshold results to a 1channel, binary image. you probably got the order of operations wrong, it should be:
img = cv2.imread('bookpage.jpg')
grayscaled = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
retval, threshold = cv2.threshold(img, 12, 255, cv2.THRESH_BINARY)
2 | No.2 Revision |
threshold threshold() results to a 1channel, binary image. you probably got the order of operations wrong, it should be:
img = cv2.imread('bookpage.jpg')
grayscaled = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
retval, threshold = cv2.threshold(img, 12, 255, cv2.THRESH_BINARY)
3 | No.3 Revision |
threshold() results to a 1channel, binary image. you probably got noobs NEVER check, if the order of operations wrong, image was actually read...
it should be:
img = cv2.imread('bookpage.jpg') cv2.imread('bookpage.jpg')
if img != None: # wrong image path
grayscaled = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
retval, threshold = cv2.threshold(img, 12, 255, cv2.THRESH_BINARY)
# any other operation