kornelski / dssim

Image similarity comparison simulating human perception (multiscale SSIM in Rust)
https://kornel.ski/dssim
GNU Affero General Public License v3.0
1.09k stars 70 forks source link

assertion failed: i <= 1.0 && i >= 0.0 #94

Closed mlwilkerson closed 3 years ago

mlwilkerson commented 3 years ago

After updating to dssim 3.0.0 two of my tests fail with:

assertion failed: i <= 1.0 && i >= 0.0

One of them compares an image to itself, and the other compares that image to itself rotated by 90 degrees.

This failure seems to occur only when dssim is built in debug mode.

It can be reproduced by building the cli v3.0.0 in debug mode and running:

$ dssim beer-solid.png beer-solid.png

or

$ dssim beer-solid.png beer-solid-sideways.png

If the cli is built in release mode and the same commands are run, the process completes as expected, reporting the dssim values: 0.00075077 and 1.64705301, respectively.

These images are rendered from the Font Awesome Free beer icon in the Solid style.

Font Awesome Free 5.15.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)

beer-solid-sideways beer-solid

kornelski commented 3 years ago

I can't reproduce. Can you attach the actual images you use?

mlwilkerson commented 3 years ago

Oh, whoops! Yeah, I had intended to attach those. I've updated the original post with them.

kornelski commented 3 years ago

Thanks. It turns out that if you add * 1.1 to an algorithm, you get numbers larger than 1.0. Who knew!?

mlwilkerson commented 3 years ago

awesome. thank you.