I'm looking for an algorithm that can identify edges across which colour is changing sharply, rather than just finding changes in brightness.

Is this just a matter of using a different colour space with existing edge detection algorithms, or is there a better approach?

  • 2
    $\begingroup$ Yes, using an appropriate color space is what you want. $\endgroup$ Aug 9, 2015 at 11:55

2 Answers 2


I think you can convert from the RGB space to the HSV one, or whatever color space has the HUE in a single channel.

Take the HUE channel, and make the edge detection on that one.

Here a simple Matlab script to achieve the result.

I = imread('image.png');
hsv = rgb2hsv(I);
hue = hsv(:,:,1);
edges = edge(uint8(hue),'sobel');

Color difference is a difference in brightness, in some color channel. So while the sum of individual channels stay the same, there is a intensity difference if there is a color difference.

Now the basic algorithms do not really specify how you should hadle the multi channel data. So there is nothing wrong with using a different color space. On the other hand nothing says you can not apply the convolution on all channels and then pick the result that is most contrasting.


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.