Search code examples
image-processingsobel

How to apply edge detection filters on colored images on Sobel?


I know how to do an image filter like the sobel-filter on 1 byte per pixel. However if you want to do it on RGB image with 24 bit per pixel, I don't know how to do it.

What is the best way to do that without having to convert the RGB image to a 8 bit one (greyscale)?


Solution

  • For the Sobel operator, like all other linear filters, one can apply the filter to each of the channels independently. That is, the output red channel is the filtered input red channel, etc.

    Note that this is true only for linear filters. For any nonlinear filter, such a process leads to false colors.