OpenImageIO icon indicating copy to clipboard operation
OpenImageIO copied to clipboard

[BUG] idiff's perceptual comparison passes images with different dimensions and contents

Open keiwando opened this issue 3 months ago • 2 comments

Describe the bug

Running idiff's perceptual difference test on two images with different dimension and obvious content differences passes the test.

These are the images being compared:

Image

Image

OpenImageIO version and dependencies

OIIO 3.1.7.0 | MacOS/x86_64 Build compiler: Apple clang 16.0 | C++17/201703 HW features enabled at build: sse2,sse3,ssse3,sse41,sse42 No CUDA support (disabled / unavailable at build time) Dependencies: BZip2 1.0.8, FFmpeg 8.0, fmt 12.1.0, Freetype 2.14.1, GIF 5.2.2, Imath 3.2.2, JXL 0.11.1, Libheif 1.20.2, libjpeg-turbo 3.1.2, LibRaw 0.21.4, libuhdr NONE, OpenColorIO 2.5.0, OpenEXR 3.4.2, openjph 0.24.5, OpenVDB NONE, PNG 1.6.50, pugixml 1.15, pybind11 3.0.1, Python3 3.14.0, Robinmap 1.4.0, TBB 2022.3.0, TIFF 4.7.1, WebP 1.6.0, ZLIB 1.3.1

(Installed and upgraded to the latest version of OpenImageIO with homebrew)

To Reproduce

Steps to reproduce the behavior:

  1. Download and extract the images from this ZIP file: images.zip
  2. In the directory with the two images, run idiff -p -abs -o diff.jpg nav_buttons_new.jpg nav_buttons.jpg

It outputs

Comparing "nav_buttons_new.jpg" and "nav_buttons.jpg" PASS

even though the images are clearly very different. This is the diff that is generates:

Image

Passing -od to the command makes it not generate any diff because the comparison passes. The expected result would be that the comparison fails.

keiwando avatar Nov 02 '25 10:11 keiwando

@keiwando how this PR might fix it, can you verify it please https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4976

pmady avatar Dec 09 '25 02:12 pmady

It's instructive to note that idiff without the -p correctly identifies the images as different. That makes me think that the bug is specific to the perceptual comparison, and not to idiff overall. I suspect you should be searching in ImageBufAlgo::compare_Yee() to discover where things are going awry when the two images do not have the same pixel window.

lgritz avatar Dec 09 '25 22:12 lgritz