FFmpeg中AVFrame到OpenCV中Mat的两种转换方法
方法一:查表法
void AVFrame2Img(AVFrame *pFrame, cv::Mat& img)
{
int frameHeight...数据转换为RGB;
YUV2RGB(pDecodedBuffer, frameWidth, frameHeight, channels, img.data);
//释放buffer...free(pDecodedBuffer);
}
子函数YUV2RGB( )实现yuv420p到RGB的转换
bool YUV2RGB(uchar* pYuvBuf, int nWidth, int nHeight...数据转换为RGB;
Yuv420p2Rgb32(pDecodedBuffer, img.data, frameWidth, frameHeight);
//释放buffer
free...(pDecodedBuffer);
}
子函数Yuv420p2Rgb32( )函数实现yuv420p到RGB32的转换
void Yuv420p2Rgb32(const uchar *yuvBuffer_in