1
votes

I am relatively new to image processing, and I have a basic question: what is a distortion of red/green/blue channel, and the distortion of the entire image ? taken from the imagemagick home site, in the 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)

I dont understand the concept, can someone explain it to me ?

1

1 Answers

2
votes

It's nothing to do with shape transformation or -distort if that is what is confusing you. All that "distortion" means, in this context, is "the specific error metric you requested". When comparing images there are various "metrics" you can select to measure:

  • AE
  • MAE
  • DSSIM
  • RMSE
  • etc.

and so on. The "distortion" is just a generic term meaning "whichever one of those you selected".

Here is a little example, a 100x10 red rectangle on a large black background.

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

enter image description here

Now roll that 1-pixel to the right and re-save as b.png:

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

enter image description here

Now compare absolute error:

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

and you can see that the 10 pixels on the left and 10 pixels on the right of the red bar are "distorted".

Now roll down one pixel instead of across and compare again:

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

and the "distortion" is 100 pixels along the top pf the red bar that have become black and 100 pixels below the bottom of the red bar that have become red.


It may make more sense if you use the convert based method of comparing rather than the compare method. Here, you use the more common convert command with 2 images and then use -compare as the operator but you now will see the variable called distortion being used and that it just refers to whatever -metric you selected:

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