If I imwrite
a binarized image, it only creates a grayscale image file not an indexed=2 file. What options do I need on the imwrite
to accomplish this? I would also like LZW compression if possible.
orig = cv2.imread('rgb.tiff')
work = cv2.cvtColor(orig, cv2.COLOR_BGR2GRAY)
work = cv2.ximgproc.niBlackThreshold(work, 255, cv2.THRESH_BINARY, 41, -0.2,
binarizationMethod=cv2.ximgproc.BINARIZATION_NICK)
cv2.imwrite('bw.tiff', work)