NVlabs / flip

A tool for visualizing and communicating the errors in rendered images.
498 stars 41 forks source link

Crash on OpenEXR images with more channels than RGB #30

Closed Latios96 closed 3 months ago

Latios96 commented 3 months ago

Hi,

I noticed that FLIP currently crashes when OpenEXR images which contain more channels than just RGB, for example AOVs.

Steps to reproduce:

  1. Download the attached example reference and test images images.zip The reference image has the following channels: R, G, B, sampleCount.R, sampleCount.G, sampleCount.B The test image has the following channels: R, G, B, absoluteRenderTime, relativeRenderTime.R, relativeRenderTime.G, relativeRenderTime.B, sampleCount.R, sampleCount.G, sampleCount.B
  2. Run flip.exe --reference reference.exr --test test.exr FLIP outputs the following and crashes:
    Undefined EXR channel name: absoluteRenderTime
    Undefined EXR channel name: relativeRenderTime.B
    Undefined EXR channel name: relativeRenderTime.G
    Undefined EXR channel name: relativeRenderTime.R
    Undefined EXR channel name: sampleCount.B
    Undefined EXR channel name: sampleCount.G
    Undefined EXR channel name: sampleCount.R
    EXR channels may be loaded in the wrong order.
    Insufficient target channels when loading EXR: need 10
    Undefined EXR channel name: sampleCount.B
    Undefined EXR channel name: sampleCount.G
    Undefined EXR channel name: sampleCount.R
    EXR channels may be loaded in the wrong order.
    Insufficient target channels when loading EXR: need 6

The differing additional channels do not matter, FLIP also crashes when running flip.exe --reference reference.exr --test reference.exr

Expected behavior: FLIP should not crash. It should load the OpenEXR images, recognize the RGB channels and compute the metrics, ignoring the other channels. I think it is not uncommon to have other channels than RGB in an OpenEXR image.

I tested on Windows 10

I filed a PR with a proposed fix: #31

inversepixel commented 3 months ago

Thank you so very much for the detailed comments and reproducer as well! Wonderful! ... and test images! I'm looking at it now.