Ask Your Question
0

YUYV422 to BGR

asked 2016-02-08 23:55:16 -0500

Bilityuk gravatar image

updated 2016-02-09 00:19:05 -0500

Good morning! Can anybody help me to convert between YUYV422 and BGR pixel formats?

1) This way i load the pixel data: cv::Mat cameraFrame = cv::Mat(h, w,CV_8UC3,(char*)YUYV422_data); 
2) i need to convert cv::Mat YUYV422  to cv::Mat BGR 
3) after processing i need to convert cv::Mat BGR to (char*)YUYV422_data.

Thank you!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2016-02-09 04:10:02 -0500

See the function cvtColor with the following (undocumented) flag: COLOR_YUV2RGB_Y422 which is the same as COLOR_YUV2RGB_UYVY. If you need other flags, don't hesitate to have a look at imgproc.hpp which shows all of them.

// Convert from yuv to rgb
cv::cvtColor( yuv, rgb, COLOR_YUV2RGB_UYVY );
// Convert from rgb to yuv
cv::cvtColor( rgb, yuv, COLOR_RGB2YUV );
edit flag offensive delete link more

Comments

Thank you it works for me

Bilityuk gravatar imageBilityuk ( 2016-02-09 21:28:29 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-02-08 23:55:16 -0500

Seen: 2,145 times

Last updated: Feb 09 '16