Ask Your Question

Converting Y + biplanar CrCb into RGB Mat

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

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


can you show, how you acquire that data ?

berak gravatar imageberak ( 2017-06-09 08:24:55 -0500 )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 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

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

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:

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


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

Seen: 305 times

Last updated: Jun 08 '17