-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Update image's luminance extraction to current recommendation. #3651
base: main
Are you sure you want to change the base?
Conversation
The BT.709-1 recommendation from 1993 (`Y = 0.2125 R + 0.7154 G + 0.0721 B`) is outdated and was replaced by BT.709-6 in 2015. Adapt the rgb2gray conversion function accordingly to `Y = 0.2126 R + 0.7152 G + 0.0722 B`. https://www.itu.int/rec/R-REC-BT.709-1-199311-S/en https://www.itu.int/rec/R-REC-BT.709-6-201506-I/en https://www.itu.int/rec/R-REC-BT.709/en
Hello @mamrehn! Thanks for updating the PR.
Comment last updated on January 15, 2019 at 12:19 Hours UTC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mamrehn thanks for your contribution! I've requested a small change with how you documented it, but otherwise I think it's worth getting in! Thanks!
skimage/color/colorconv.py
Outdated
@@ -751,7 +751,8 @@ def rgbcie2rgb(rgbcie): | |||
|
|||
|
|||
def rgb2gray(rgb): | |||
"""Compute luminance of an RGB image. | |||
"""Compute luminance of an RGB image, | |||
according to ITU-R BT.709-6 (2015) recommendation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this line to a Notes section (see numpy documentation guide) and add a versionchanged tag for 0.15. Here's an example. In the note, could you please note that prior to 0.15, the earlier coefficients were used? This will help future users to understand any discrepancy in their results between versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thanks @jni !
Fix after comment by @jni. Thanks!
Help understand discrepancy in results between versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mamrehn! Looks great now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops! I thought this might be a problem: now a whole bunch of tests are failing because we expect the old conversion. This is going to be trickier than I had hoped...
https://travis-ci.org/scikit-image/scikit-image/jobs/479854144#L2969
These 5 tests just fail due to hard coded ground truth values. Then modify |
I think it is wise to have different color conversion formats for rgb2gray. Though it is a 1E-3 error, and uint8 images don't even have athat precision, it might trip up some people. Does this need deprecation? if so, it would probably only be default after it becomes obsolete again.... |
Hey everyone. It seems like this has been stalled a little bit. I think the option to include a new I understand that this change will lead to small changes for images >8 bit? In that case it's probably easiest to aim for a merge after that transition. So I'm updating the milestone for now. However, @mamrehn, if you want to pick this up again, we can still try to merge it before |
Description
[Tell us about your new feature, improvement, or fix! If relevant, please supplement the PR with images.]
The ITU-R BT.709-1 recommendation from 1993 (
Y = 0.2125 R + 0.7154 G + 0.0721 B
) is outdated and was replaced by BT.709-6 in 2015.Adapt the rgb2gray conversion function accordingly to
Y = 0.2126 R + 0.7152 G + 0.0722 B
.https://www.itu.int/rec/R-REC-BT.709-1-199311-S/en
https://www.itu.int/rec/R-REC-BT.709-6-201506-I/en
https://www.itu.int/rec/R-REC-BT.709/en
Checklist
[It's fine to submit PRs which are a work in progress! But before they are merged, all PRs should provide:]
./doc/examples
(new features only)./benchmarks
, if your changes aren't covered by anexisting benchmark
[For detailed information on these and other aspects see scikit-image contribution guidelines]
References
[If this is a bug-fix or enhancement, it closes issue # ]
[If this is a new feature, it implements the following paper: ]
For reviewers
(Don't remove the checklist below.)
later.
__init__.py
.doc/release/release_dev.rst
.@meeseeksdev backport to v0.14.x