-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
YUY2 format to rgb format #4646
Comments
I wonder if you might be able to adapt the conversion information in the link below. https://answers.opencv.org/question/87083/yuyv422-to-bgr/?answer=202592#post-id-202592 |
@MartyG-RealSense thanks for the reply. |
Apologies for the delay in responding further. I was carefully researching your error message. I came across this case with the same error: From what I can gather (I am not an OpenCV expert), the scn==2 error may occur because the convert function needs an image with 2 channels. |
yes, in order to convert YUY2 to rgb the source image is required to contains 2 channels. However, the input array size after reading the rgb image with input YUYV format contains a single channel 2d array only.
yuyv_image array size = i also came across show_yuv_frame() developed few years ago shows that |
@waiyc Sorry for later response. Did you get it through now? Looking forward to your update. Thanks! |
@waiyc Any update? Thanks! |
@waiyc Will close the issue if no other questions. Thanks! |
Here's a solution... the trick is that YUY2 format needs to be put into Y (channel 0) and UV (channel 1). Moving forward I will never use YUY2 with OpenCV since it is heavily biased toward BGR.
|
Thanks so much for sharing your solution with the RealSense community @tschoepflin :) |
Hi,
Is there anyways to convert the YUY2 format from RGB camera to rgb format using opencv.
I have tried using
cv2,cvtColor()
withCOLOR_YUV2BGR_YUY2
but failed to convert.The text was updated successfully, but these errors were encountered: