Ask Your Question
0

Any method to extract edges from a color image directly without converting it into grayscale image?

asked 2017-09-14 03:40:04 -0600

Santhosh1 gravatar image

Grayscale images tend to fail on detecting edges when the color of the object and the background are the same.

Is there any method that allows us to extract the edges directly from a color image?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-09-14 03:50:02 -0600

berak gravatar image

edge detection works only on a single channel image, but that does not mean, that it must be a grayscale version of a color image.

you could e.g. convert your image from bgr to hsv, and try to extract edges from the Hue channel (or from U or V in a YUV image, whatever suits your needs best)

edit flag offensive delete link more

Comments

1
Santhosh1 gravatar imageSanthosh1 ( 2017-09-14 04:14:23 -0600 )edit

did not knew the paper, thanks for the link. the main breadwinner there seems to be the sobel enhancement, but the edge extraction is still done on an intensity image (so no difference to grayscale).

myidea of applying it to hue was more for the case, where there are borders due to different colors (think red and green), but with same intensity (which would vanish with a simple greyscale pass)

so, what do you need to do ? do you want to find contours ? do you want to highlight edges in color images ? (like in that paper ?)

berak gravatar imageberak ( 2017-09-14 06:04:20 -0600 )edit

@berak You are welcome. I tried Edge extraction through V it came out similar to the edge extracted from a grayscale image. My interested image doesn't have a lot of red and green in it to detect edges ๐Ÿ˜… I need to first extract the edges then only will I be able to think about proceeding to contours.(As it is nearly impossible to design an alogorithm that completes the missing edges for us)

Santhosh1 gravatar imageSanthosh1 ( 2017-09-14 07:16:51 -0600 )edit

" I tried Edge extraction through V it came out similar" -- yea, expected, unfortunately ;(

berak gravatar imageberak ( 2017-09-14 07:26:06 -0600 )edit

Is there any way we can complete the missing edges? I know we only have X and Y coordinate value of the edge. The shape of the edge can be anything which makes things more complicated.

Santhosh1 gravatar imageSanthosh1 ( 2017-09-14 07:55:27 -0600 )edit

hmm, i'm clearly lacking ideas here, but if you have a contour, you can draw it as a "closed" polygon, or try to find the convex hull of it.

berak gravatar imageberak ( 2017-09-14 08:09:38 -0600 )edit

Am I misunderstanding something? Canny edge detection supports multichannel image processing and it should be more stable than converting the image to grayscale before.

The difference to converting the image before is that in the Canny algorithm Sobel is calculated for each channel independent. After that the strongest gradient value for each pixel is chosen out of the channels for further edge detection. The step is done here. So where is the problem here?

But there is a small restriction: For multi channel images inplace-processing is not supported. You have to use another Mat as edge image.

matman gravatar imagematman ( 2017-09-14 13:26:51 -0600 )edit

@berak I have created one more question for the broken edge thing. Link

Santhosh1 gravatar imageSanthosh1 ( 2017-09-15 00:00:18 -0600 )edit

@matman Yup got it working on the color image. I does work on multi channel :) Problem is it still is not able to detect the edges correctly ๐Ÿ˜…

Santhosh1 gravatar imageSanthosh1 ( 2017-09-15 00:09:51 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-09-14 03:40:04 -0600

Seen: 2,361 times

Last updated: Sep 14 '17