Skip to content

fixed wrong equivalence in YUV conversion#7481

Merged
vpisarev merged 2 commits intoopencv:masterfrom
savuor:fix/yuv_channel_order
Nov 23, 2016
Merged

fixed wrong equivalence in YUV conversion#7481
vpisarev merged 2 commits intoopencv:masterfrom
savuor:fix/yuv_channel_order

Conversation

@savuor
Copy link
Copy Markdown
Contributor

@savuor savuor commented Oct 13, 2016

resolves #4946

This pullrequest changes

Fixes the conversion from/to RGB and YUV
Channel order is now YUV, not YVU

@savuor savuor added the backport is needed Label for maintainers. Authors of PR can ignore this label Oct 13, 2016
@savuor
Copy link
Copy Markdown
Contributor Author

savuor commented Oct 13, 2016

@terfendail please take look at this

@savuor savuor changed the title fixed wrong equivalence in YUV conversion WIP: fixed wrong equivalence in YUV conversion Oct 13, 2016
@StevenPuttemans
Copy link
Copy Markdown

@savuor are we sure this is an actual bug?

I took this comment from the history of the issue

I think this has been implemented correctly. OpenCV uses YCrCb whereas Matlab uses YCbCr.

@savuor
Copy link
Copy Markdown
Contributor Author

savuor commented Oct 14, 2016

@StevenPuttemans

  • I will not touch YCrCb implementations, they seem to be correct
  • I didn't fix the channel order yet (this is gonna be YVU as it's done now in OpenCV which corresponds to YCrCb). However, the channel order in OpenCL implementation is YUV, not YVU, it means that I should change the channel order at least there.

Anyway, there are real bugs in the way how channels in YUV are calculated, the bugs are described here.
To illustrate the first bug just take look at the pictures below.

This is source image.
source
This is correct Y channel (as we get from YCrCb conversion).
correct Y channel
And this is a Y channelf from YUV conversion:
Y channel from current YUV
Why do I think it's incorect? Because red birds are darker than blue ones although both Y channels should be the same.

I also confirmed other 2 bugs and gonna fix them too.

@StevenPuttemans
Copy link
Copy Markdown

👍

@savuor savuor force-pushed the fix/yuv_channel_order branch 4 times, most recently from 303217f to 1f7c2b4 Compare October 19, 2016 20:51
@savuor savuor force-pushed the fix/yuv_channel_order branch from 1f7c2b4 to 6b662f4 Compare October 21, 2016 19:44
@savuor savuor changed the title WIP: fixed wrong equivalence in YUV conversion fixed wrong equivalence in YUV conversion Oct 21, 2016
@savuor savuor added port/backport done Label for maintainers. Authors of PR can ignore this and removed backport is needed Label for maintainers. Authors of PR can ignore this labels Oct 24, 2016
@terfendail terfendail self-assigned this Oct 25, 2016
@savuor savuor force-pushed the fix/yuv_channel_order branch from 5d5d2a1 to b355acb Compare November 3, 2016 16:09
@vpisarev vpisarev self-assigned this Nov 23, 2016
@vpisarev
Copy link
Copy Markdown
Contributor

thanks, @savuor! let's finally merge it in! 👍

@vpisarev vpisarev merged commit 7db43f9 into opencv:master Nov 23, 2016
@savuor savuor deleted the fix/yuv_channel_order branch November 23, 2016 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

port/backport done Label for maintainers. Authors of PR can ignore this

Projects

None yet

Development

Successfully merging this pull request may close these issues.

YUV implemented incorrectly

4 participants