3
votes

In the canny edge detector the input required is a gray image...

Is there any direct color edge detector function in open-cv ? Or is it same if i convert to gray scale and use canny ?

I ask this because I need to see the edge detection map of a color image for further processing... That is I need to calculate all the horizontal and vertical line segments in a color image... Thus i was thinking of first calculating all edges of the image ...

Can someone help me how i should progress ...

1

1 Answers

5
votes

Matthias Odisio is correct thanks you even corrected me and you've explained the reason very well. The solution then would be to perform edge detection on each colour spectrum:

 Image<Bgr, Byte> img  = new Image<Bgr, Byte>(open.FileName);
 Image<Bgr, Byte> Result = new Image<Bgr, Byte>(img.Size);
 Result[0] = img[0].Canny(new Gray(10), new Gray(60));
 Result[1] = img[0].Canny(new Gray(10), new Gray(60));
 Result[2] = img[0].Canny(new Gray(10), new Gray(60));

Hope this helps,

Chris