Ask Your Question
0

Converting Y + biplanar CrCb into RGB Mat

asked 2017-06-08 05:00:38 -0600

I have a data stored in a layout with two planes. First plane is Y plane and second one is CrCb, where those values are interleaved. Each pixel in Y plane is 8 bit long and each pixel of CrCb plane is 16 bits long (8 bits Cr and 8 bits for Cb). How can I create a cv::Mat from this format and convert it to ordinary RGB (or BGR) format? Thank you.

edit retag flag offensive close merge delete

Comments

can you show, how you acquire that data ?

berak gravatar imageberak ( 2017-06-09 08:24:55 -0600 )edit

You'll have to map it into two cv::Mat. The first is the Y data, and the second is a two channel Mat to hold the U and V. Then split the U and V, and merge all three.

Then it's just a standard cvtColor.

Tetragramm gravatar imageTetragramm ( 2017-06-09 15:40:25 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2019-01-23 06:18:05 -0600

n00dle gravatar image

Just to update this for anyone coming from Google - there is now a cvtColorTwoPlane method for precisely this use case, docs here: https://docs.opencv.org/3.4.2/d7/d1b/...

edit flag offensive delete link more

Comments

Is there a way to go in reverse? From the RGB/A Mat to Y Mat and CbCr Mat?

dsweeney gravatar imagedsweeney ( 2019-09-26 16:37:17 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-06-08 05:00:38 -0600

Seen: 1,291 times

Last updated: Jun 08 '17