I'm doing some image processing to learn, I'm using openCV with the new C++ iterface.
I have an RGB image, I read the grayscale version, equalize the histogram, then use canny to detect edges.
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?
My 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<binary.rows;i++){
for(int j=0;j<binary.cols;j++){
std::cout << binary.at<float>(i,j)<< ",";
}
std::cout << "\n";
}
This is a 183x183 matrix and I can see a lot of values even some nan
.
How can I make this binary?
For the Canny function I use a threshold value obtaining the "mean" value of the grayscale image; I saw it here: http://www.kerrywong.com/2009/05/07/canny-edge-detection-auto-thresholding/.