Fix greyscale computation and inverted coords#8905
Merged
tianyizheng02 merged 4 commits intoTheAlgorithms:masterfrom Jul 29, 2023
Merged
Fix greyscale computation and inverted coords#8905tianyizheng02 merged 4 commits intoTheAlgorithms:masterfrom
tianyizheng02 merged 4 commits intoTheAlgorithms:masterfrom
Conversation
CaedenPH
requested changes
Jul 29, 2023
Contributor
CaedenPH
left a comment
There was a problem hiding this comment.
Could you add some doctests to prove that it will reach 255 and works correctly please
Contributor
Author
Good idea, thanks. done :) |
tianyizheng02
approved these changes
Jul 29, 2023
tianyizheng02
requested changes
Jul 29, 2023
| 255.0 | ||
| """ | ||
| return 0.114 * blue + 0.587 * green + 0.2126 * red | ||
| return 0.114 * blue + 0.587 * green + 0.299 * red |
Contributor
There was a problem hiding this comment.
according to Internet, it's either (0.2126R + 0.7152G + 0.0722B) or (0.299R + 0.587G + 0.114B)
Could you add a source for these numbers so that we can avoid mistakes like this in the future?
Contributor
Author
There was a problem hiding this comment.
Good idea, done :)
tianyizheng02
approved these changes
Jul 29, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your change:
Checklist:
The change:
Hello there,
I've used your algorithm to re-implement it in C for a side-project of mine, and noticed two little bugs in it:
the luminance calculation is incorrect - according to Internet, it's either (0.2126R + 0.7152G + 0.0722B) or (0.299R + 0.587G + 0.114B). Here, we had a mix of both (and the greyscale value could never reach 255.
the current_error setting used inverted coordinates.
Hope this helps!