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?