title: OpenCV binary image get only white pixels don't work
body: <p>I'm doing some image processing to learn, I'm using openCV with the new C++ iterface.</p>
  
  <p>I have an RGB image, I read the grayscale version, equalize the histogram, then use canny to detect edges.</p>
  
  <p>The question is: does the Canny function return a grayscale image or a binary one?
  I use a double for loop to check the values of pixels in the image resulting of applying canny edge detector, and I have a lot of values totally different. In a binary image must be only two values 0 or 1 (0 or 255)... How can I do that?</p>
  
  <p>My code: </p>
  
  <pre><code>imagen = imread(nombre_imagen,0); //lee la imagen en escala de grises
  equalizeHist(imagen,imagen);
  Canny(binary,binary,0.66*threshold,1.33*threshold,3,true);
  for(int i=0;i&lt;binary.rows;i++){
      for(int j=0;j&lt;binary.cols;j++){
         std::cout &lt;&lt; binary.at&lt;float&gt;(i,j)&lt;&lt; ",";
      }
      std::cout &lt;&lt; "\n";
  }
  </code></pre>
  
  <p>This is a 183x183 matrix and I can see a lot of values even some <code>nan</code>.
  How can I make this binary?</p>
  
  <p>For the Canny function I use a threshold value obtaining the "mean" value of the grayscale image; I saw it here: <a href="http://www.kerrywong.com/2009/05/07/canny-edge-detection-auto-thresholding/" rel="nofollow">http://www.kerrywong.com/2009/05/07/canny-edge-detection-auto-thresholding/</a>.</p>