Ask Your Question

Revision history [back]

how to set yuv420p in AVFrame to Mat?

I read a lot of posts, but not find related to planar format to Mat. As a result, want it is yuv420p to rgb. so i tried with Mat yuv420p(pVCtx->height+pVCtx->height/2, pVCtx->width, CV_8UC3,frame->data[0]); Mat rgb; cvtColor(yuv420p,rgb,CV_YUV420p2RGB); but failed. how to change yuv420p to Mat?

how to set yuv420p in AVFrame to Mat?

I read a lot of posts, but not find related to planar format to Mat. As a result, want it is yuv420p to rgb. so i tried with

Mat yuv420p(pVCtx->height+pVCtx->height/2, pVCtx->width, CV_8UC3,frame->data[0]);
Mat rgb;
cvtColor(yuv420p,rgb,CV_YUV420p2RGB);

but failed. how to change yuv420p to Mat?