title: OpenCV Save a Mat as Binary (1-bit depth) TIFF
body: <p>Suppose we have a <code>Mat</code> after applying the OpenCv's <code>Imgproc.adaptiveThreshold</code>:</p>
  
  <pre><code>    Mat srcImage = ...;
      Mat binaryImage = new Mat();
  
      Imgproc.adaptiveThreshold(srcImage, binaryImage, 255, Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C,
          Imgproc.THRESH_BINARY, THRESHOLD_BLOCK_SIZE, 10);
  </code></pre>
  
  <p>When I save the <code>binaryImage</code> using <code>Highgui.imwrite</code>:</p>
  
  <pre><code>boolean isOk = Highgui.imwrite("sample.tiff", binaryImage);
  </code></pre>
  
  <p>Everything is ok except that output TIFF is not actually a binary TIFF - it's a 8-bit depth image:
  <img src="https://i.stack.imgur.com/Wmhgo.png" alt="enter image description here"></p>
  
  <p>What I'm trying to achieve is a similar to the below TIFF format with the 1-bit depth:</p>
  
  <p><img src="https://i.stack.imgur.com/57G8G.png" alt="enter image description here"></p>
  
  <p><strong>The question is how to do so with OpenCV?</strong></p>