combining the result of sobel operator into a color egde detector

9 views (last 30 days)
i am applying sobel operator to each of the RGB color planes comprising the image. now, how can i combine these results into a color edge detector? and if i can then what are the difference between the resulting edges and the grayscale image? can i represent the resulting edges by matlab code?

Accepted Answer

Image Analyst
Image Analyst on 23 Feb 2013
Edited: Image Analyst on 23 Feb 2013
I don't think that will do what you think it will, but go ahead and see. Experiment and learn. You can combine the results with cat():
rgbImage = cat(3, redEdgeImage, greenEdgeImage, blueEdgeImage);
imshow(rgbImage);
You might want to convert to hsv color space:
hsv = rgb2hsv(rgbImage);
hImage = hsv(:,:,1);
sImage = hsv(:,:,2);
vImage = hsv(:,:,3);
and do edge detection on either the v channel or the h channel, depending on how you define edge. Again, experiment and see what you can get. There are papers on this in Vision Bib: Search Vision Bib
  4 Comments
Sat m
Sat m on 23 Feb 2013
i am having confusion in 1 case. i can see that in case of combining the redegde, greenedge and blueedge, i see morer edges that in the result of sobel applied on a grayscale image. is this becasue, grayscale images has less channels than RGB image and as sobel operator algorithm applied on each channel to get the resultant edges? is this the reason for getting more edges in combined rgb image?
Image Analyst
Image Analyst on 23 Feb 2013
When you combine them, the combined image may show edges in one channel that didn't show up in the other channels. For example an edge that shows up in the blue channel may not show up in the red channel so the red channel appears to have less edge pixels. But when you combine them, any channel that had an edge at a location will show up, even if it's only one channel, so the combined image may seem to have more edges. To oversimplify, let's say the red channel had 1000 edge pixels, the green channel had 2000 edge pixels, and the blue channel had 3000 edge pixels. Now let's say that none of those pixels overlapped (were in the same location). So the most any single channel has is 3000 edge pixels but in the combined image you see 1000+2000+3000 = 6000 edge pixels, which is more than any one color channel had.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!