how to set yuv420p in AVFrame to Mat?

asked 2018-04-28 08:29:02 -0600

q2ou gravatar image

updated 2018-04-28 10:55:36 -0600

LBerger gravatar image

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?

edit retag flag offensive close merge delete