ColorRGB GetRGBPixel(const AVFrame& frame, int x, int y)
{
// Y component
const unsigned char y = frame.data[0][frame.linesize[0]*y + x];
// U, V components
x /= 2;
y /= 2;
const unsigned char u = frame.data[1][frame.linesize[1]*y + x];
const unsigned char v = frame.data[2][frame.linesize[2]*y + x];
// RGB conversion
const unsigned char r = y + 1.402*(v-128);
const unsigned char g = y - 0.344*(u-128) - 0.714*(v-128);
const unsigned char b = y + 1.772*(u-128);
return ColorRGB(r, g, b);
}
Extract Formated Pixel RGB Info By Using FFMEPG
猜你喜欢
转载自blog.csdn.net/qq_29094161/article/details/84963145
今日推荐
周排行