C++ Convert buffer data from YUV 4:2:2 (UYVY format) into YUV

Hi all,

I have a video streamed from a source camera, that provides each frame into a uchar* buffer.
This buffer is YUV 4:2:2, using UYVY format.

I want to obtain a workable Mat in YUV, where I can split channels and do every filter I want.
The problem is that UYVY format is compressed and I don’t find any way to explode data directly into YUV format, whitout passing from BGR.

For example, I tried this, but I don’t want for performance reasons, to pass from BGR:

cvtColor(inMat, middleMat, COLOR_YUV2BGR_UYVY);
cvtColor(middleMat, outMat, COLOR_BGR2YUV);

I need something similar to:

cvtColor(inMat, outMat, COLOR_YUV2YUV_UYVY);

Thanks in advance
Giuseppe

crosspost: OpenCV C++ convert buffer image from YUV 4:2:2 (UYVY format) into YUV - Stack Overflow