3

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 Answer 1

5

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

Sign up to request clarification or add additional context in comments.

2 Comments

I would perform edge detection separately on all 3 color channels BEFORE thinning: detect edges, perform MAX operation on all the channels to get as many edges as possible, and only then perform thinning and hysteresis.
Hi, yes this is a much better approach but would require the canny method to be re-written to support it. Unfortunately the opencv canny edge detection method only supports grayscale images and will perform thinning and hysteresis thresholding automatically. It should be quite easy to adapt the opencv code if I remember from playing with it but I'm afraid I don't have the time to test and submit a revision.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.