title: Store OpenCV boolean matrix on disk
body: <p>I have a float matrix of 1024x1024 and I want to keep sign of this matrix inside a file. For this purpose, I want to keep the sign matrix as <code>Matrix of boolean</code> which I fail to do.</p>
  
  <p>Assume, my matrix is:</p>
  
  <pre><code>2.312, 0.232, -2,132
  5.754,  -4,34, -3.23
  -4.34,  -1.23, 7.9453 
  </code></pre>
  
  <p>My output should be</p>
  
  <pre><code> 1,1,0
   1,0,0
   0,0,1
  </code></pre>
  
  <p>Since float is 4Byte and my matrix size is <code>10^20(1M)</code> the size is 4MB and boolean is 1bit and matrix size is 1M, I expect the bool mat to be around <code>1Mb=128KB</code> however, when I use <code>threshold</code> method in <code>opencv</code> my output file is <code>1MB</code> which means the file is saved as uchar(8bit). </p>
  
  <p>I tried to use imwrite but it didn't work. </p>
  
  <p><strong>EDIT:</strong> I realized that I didn't mention speed is also another important factor for my tests. I'm loading approximately 10 million of 1K*1K matrix from disk. </p>
  
  <p>Thanks in advance</p>