title: OpenCV - get grey value from an image
body: <p>Hello everybody right now I'm trying to getting grey value for every pixel in an image
  what I mean with grey value is the white or black level from an image let's say 0 for white and 1 for black. for an example for this image</p>
  
  <p><img src="https://i.stack.imgur.com/z8moX.jpg" alt="enter image description here"></p>
  
  <p>the value I want will be like</p>
  
  <pre><code> 0 0 0 0 0 0
   0 1 1 1 0 0
   0 0 1 1 0 0
   0 0 1 1 0 0
   0 0 1 1 0 0
   0 0 1 1 0 0
   0 0 1 1 0 0
   0 0 0 0 0 0
  </code></pre>
  
  <p>is this possible? if yes how to do it with OpenCV in C? or if it's impossible with OpenCV is there any other library that can do this? </p>