问题
Suppose we have a Mat
after applying the OpenCv's Imgproc.adaptiveThreshold
:
Mat srcImage = ...;
Mat binaryImage = new Mat();
Imgproc.adaptiveThreshold(srcImage, binaryImage, 255, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C,
Imgproc.THRESH_BINARY, THRESHOLD_BLOCK_SIZE, 10);
When I save the binaryImage
using Highgui.imwrite
:
boolean isOk = Highgui.imwrite("sample.tiff", binaryImage);
Everything is ok except that output TIFF is not actually a binary TIFF - it's a 8-bit depth image:
What I'm trying to achieve is a similar to the below TIFF format with the 1-bit depth:
The question is how to do so with OpenCV?
回答1:
Only 8-bit (or 16-bit unsigned) single-channel or 3-channel images can be saved by imwrite.
来源:https://stackoverflow.com/questions/30889959/opencv-save-a-mat-as-binary-1-bit-depth-tiff