-
-
Notifications
You must be signed in to change notification settings - Fork 55.6k
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
Converting RGB to YCrCb #17370
Comments
@YUHAOOOO, OpenCV probably uses integer arithmetic. Make sure that |
@dkurt, thanks a lot. I do some experiments try to test
And the test code is also changed to check where the difference between the value output by
There are some outputs, which make me confused.
Some outputs including the 1st line, the 3rd line are strange. In these cases, Rouding rule can not work. |
Please print the source RGB pixel as well. |
The source value is as follows (RGB tuples):
The corresponding test code is:
|
There are floating point versions of Value difference 1 is acceptable due to rounding errors. |
When I use the floating point version, it is much better than integer-based implementation. I am just curious why it happens in a same computer. Is it due to design difference between Python and C++ in rounding rule? |
@YUHAOOOO, because you just compare different implementations. Inside OpenCV, for uin8 input different algorithm is used comparing to fp32 input. |
Thanks a lot. |
System information (version)
Detailed description
I have a problem when I convert the color space from RGB to YCrCb. Accroding to RGB ↔ YCrCb JPEG (or YCC), I write a function named
rgb2ycrcb
.Steps to reproduce
I use a picture named
xxx.png
to test this function. The code works as follows:But the output is:
You can see the output of
cvtColor
is much different with thergb2ycrcb
. Are there some mistakes in my functionrgb2ycrcb
?Issue submission checklist
I checked the problem with documentation, FAQ, open issues, answers.opencv.org, Stack Overflow, etc and have not found solution.
The text was updated successfully, but these errors were encountered: