Skip to content

Conversation

@fernando79513
Copy link
Collaborator

Description

For some weird reason, when the two images were the same, the tests were failing in later versions of python (3.13), but not in early ones. This was probably due to a rounding error.

# python 3.8
>>> _get_psnr(img1, img2)
1.0686215807909677e-07
# python 3.13
>>> _get_psnr(img1, img2)
0.0

Nevertheless, the implementation of the algorithm was wrong, and it returned 0 instead of a big value if the images were exactly the same.

I've just changed it to use the default one from opencv (cv2.PSNR)

Resolved issues

Documentation

Tests

Tested with python 3.13

@fernando79513 fernando79513 changed the title Removed custom implementation and using cv2 Removed custom implementation and using cv2 (BugFix) Mar 6, 2025
@codecov
Copy link

codecov bot commented Mar 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 49.62%. Comparing base (7817ae2) to head (f285420).
Report is 123 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1776      +/-   ##
==========================================
- Coverage   49.63%   49.62%   -0.02%     
==========================================
  Files         377      377              
  Lines       40630    40619      -11     
  Branches     6830     6829       -1     
==========================================
- Hits        20168    20157      -11     
  Misses      19740    19740              
  Partials      722      722              
Flag Coverage Δ
checkbox-support ∅ <100.00%> (∅)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Hook25 Hook25 merged commit da6b4e9 into main Mar 11, 2025
19 checks passed
@Hook25 Hook25 deleted the fix-psnr-algorithm branch March 11, 2025 09:25
stanley31huang pushed a commit that referenced this pull request Mar 28, 2025
* Removed custom implementation and using cv2

* Fixed black formatting
mreed8855 pushed a commit that referenced this pull request Jul 31, 2025
* Removed custom implementation and using cv2

* Fixed black formatting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants