8

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 Answers2

3

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');
imshow(edges);
psicomante
  • 610
  • 1
  • 5
  • 11
2

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.

joojaa
  • 8,437
  • 1
  • 24
  • 47