什么是图像中通道的失真?

What is distortion of a channel in an image?

我对图像处理比较陌生,有一个基本问题:什么是red/green/blue通道的失真,以及整个图像的失真? 取自 imagemagick 主页,在 compare command section:

In addition to the visual interpretation of the difference in an image and its reconstruction, we report a mathematical measure of the difference:

magick compare -verbose -metric mae rose.jpg reconstruct.jpg difference.png Image: rose.jpg Channel distortion: MAE red: 2282.91 (0.034835) green: 1853.99 (0.0282901) blue: 2008.67 (0.0306503)
all: 1536.39 (0.0234439)

我不明白这个概念,谁能给我解释一下吗?

这与形状变换无关,或者 -distort 如果这让您感到困惑。在这种情况下,"distortion" 的意思是 "the specific error metric you requested"。比较图像时有各种 "metrics" 你可以 select 测量:

  • AE
  • DSSIM
  • 均方根误差
  • 等等

等等。 "distortion" 只是一个通用术语,意思是 "whichever one of those you selected".

这是一个小例子,在大的黑色背景上有一个 100x10 的红色矩形。

convert -size 100x10 xc:red -bordercolor black -border 100 a.png

现在向右滚动 1 个像素并重新保存为 b.png:

convert a.png -roll +1+0 b.png

现在比较绝对误差:

compare -metric ae [ab].png null:
20

可以看到红色条左边10个像素和右边10个像素是"distorted".

现在向下滚动一个像素而不是横向滚动并再次比较:

convert a.png -roll +0+1 b.png
compare -metric ae [ab].png null:
200

"distortion" 是红色条顶部 100 像素变成黑色,红色条底部下方 100 像素变成红色.


如果您使用基于 convert 的比较方法而不是 compare 方法可能更有意义。在这里,您对 2 个图像使用更常见的 convert 命令,然后使用 -compare 作为运算符,但您现在会看到 变量 称为 distortion 被使用并且它只是指任何 -metric 你 selected:

convert a.png b.png -metric AE -compare -format "%[distortion]" info:
200