compare with psnr metric

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
jspark
Posts: 2
Joined: 2011-08-21T23:47:20-07:00
Authentication code: 8675308

compare with psnr metric

Post by jspark »

Hi guys

I am using imagemagick for measuring psnr between antialiased rendered images.

recently i've compare two sets of images that only have different background colors.

let's see what happen

first, i've compare -metric psnr for white back ground image with bunny
Image
and
Image

they looks similar, but have some differences inside the object along with the shadows and edges.
when i 've compared two image, i've got PSNR value 37.6311

BUT when i've set the background color of image to blakc like followings
Image
and
Image

i've got PSNR of 45. 7287!!!

as you can see the difference between two comparisons are quit similar

Image
Image

and difference of output from imagemagick also indicate that area of rabbit in the image are identical, the images are only differs in background
Image

As i know PSNR value is focused on the difference(error) between two images, then why the psnr value has changed.

Isn't it bug? or bug of my knowledge?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: compare with psnr metric

Post by anthony »

The problem is that the edge pixels are anti-aliased with the background. Different background, different colored edge pixels, slightly different, differences.

If you want to remove the effect of the background best idea is to always have the image layered on a fixed common background color.

I do not suggest using transparency, as you will still need to ensure all fully-transparent colors are fixed for proper comparison.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
jspark
Posts: 2
Joined: 2011-08-21T23:47:20-07:00
Authentication code: 8675308

Re: compare with psnr metric

Post by jspark »

Yes! that's true! The "difference" is actually changed!! Thanks! Anthony!
Post Reply