fix yuv and luv color conversions - #82
Merged
Merged
Conversation
Owner
|
Kinda picky here, but pls rename |
Contributor
Author
|
No problem, @jasmcaus. It's done! |
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.
Description
Ten color conversions compute a BGR intermediate and then discard it, converting the original YUV/LUV array as if it were BGR. The result is silently wrong pixel values:
yuv2gray,yuv2hsv,yuv2hls,yuv2lab,yuv2luv(caer/color/_yuv.py)luv2gray,luv2hsv,luv2hls,luv2lab,luv2yuv(caer/color/_luv.py)caer.to_gray(),to_hsv(),to_hls(),to_lab(),to_yuv()andto_luv()call these functions, so they were affected too for YUV/LUV inputs.Reproduction
Tests
The existing tests only checked the output shape and the
cspaceflag, so the bug went unnoticed. Each of the 10 affected tests intests/color/test_yuv.pyandtests/color/test_luv.pynow also asserts the result equals OpenCV'sX -> BGR -> Yconversion. These asserts fail ondev(10 failed) and pass with the fix. The full suite passes locally (pytest -v ./tests: 83 passed).Types of changes
examplesRelated Issues
Closes #81
Checklist:
devand notmaster(important).dev(optional)