如何在彩色图像上使用Sobel边缘检测滤镜?

huangapple go评论59阅读模式
英文:

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

问题

我知道如何执行像Sobel滤波器这样的图像滤波,每个像素1字节。但是,如果您想在每个像素24位的RGB图像上执行此操作,我不知道该如何做。

在不必将RGB图像转换为8位(灰度)图像的情况下,最佳方法是什么?

英文:

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)?

答案1

得分: 3

对于Sobel算子,就像所有其他线性滤波器一样,可以独立地将滤波器应用于每个通道。也就是说,输出的红色通道是经过滤波的输入红色通道,依此类推。

请注意,这仅适用于线性滤波器。对于任何非线性滤波器,这样的处理会导致虚假的颜色。

英文:

For the Sobel operator, like all other linear filter, 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 filter. For any nonlinear filter, such a process leads to false colors.

答案2

得分: 0

  1. 对于每个颜色通道,通过应用Sobel算子并除以8来计算梯度幅值(导数)。

  2. 除非你是为色盲人士做这个,每个颜色通道中的梯度(以及由此产生的边缘)都是计算在内的。你可以将这些梯度幅度矩阵合并成一个矩阵,保留最高的幅度。

英文:
  1. For each color channel, calculate gradient magnitudes (derivatives) by applying the Sobel operator and dividing by 8.

  2. Unless you’re doing this for colorblinds, gradients (and edges from them) in every color channel do count. You could merge those gradient magnitude matrices into one matrix, keeping the highest magnitudes.

huangapple
  • 本文由 发表于 2020年1月4日 00:32:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/59582056.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定