The file I saved with imwrite(“test.tif”,dst) is 8 bits, but I want to save Mat as a 1-bit depth TIF file. How should I do it?
As shown in the following figure:
a Mat’s type can’t be “1-bit”. that’s the first issue.
given a Mat of type CV_8U, flags to imwrite might support your goal… but I don’t see any appropriate IMWRITE_* flags. I could be mistaken.
Here’s the docs page where I would expect to find a flag, if it exists: OpenCV: Flags used for image file reading and writing
you’ll probably have to use a tiff library directly.
you could save a PNG. there seems to be IMWRITE_PNG_BILEVEL.
