Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overflow in PSNR computation #288

Closed
incenger opened this issue May 3, 2021 · 4 comments · Fixed by #294
Closed

Overflow in PSNR computation #288

incenger opened this issue May 3, 2021 · 4 comments · Fixed by #294
Assignees

Comments

@incenger
Copy link

incenger commented May 3, 2021

In the function to compute PSNR score, if the two input image arrays of type np.unint8, using (img1 - img2)**2 can overflow. This causes incorrect PSNR evaluation result, especially when calling the function without convert_to="Y" argument. I think this could be fixed by either explicitly converting the input images into float type or adding the data type requirement into the document.

@innerlee
Copy link
Contributor

innerlee commented May 7, 2021

@Yshuo-Li pls check if there are corner cases, and fix & add unittest if it is true

@Yshuo-Li
Copy link
Collaborator

Yshuo-Li commented May 7, 2021

@incenger , thank you for your reminder, I will fix this issue later.
Note: In this repo, image arrays send to this function are of type np.float32. This issue does not affect the normal use of the repo.

@innerlee innerlee added the Bug:P2 label May 7, 2021
@incenger
Copy link
Author

incenger commented May 7, 2021

@Yshuo-Li Yes, I only found this issue when using the function on my own code :D

@Yshuo-Li
Copy link
Collaborator

Yshuo-Li commented May 7, 2021

@Yshuo-Li pls check if there are corner cases, and fix & add unittest if it is true

Fix this issue in "Tiny fix of PSNR" #294

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 a pull request may close this issue.

3 participants