概述
void BGR2NV21( unsigned char *imgSrc, unsigned char *imgDst, int width, int height )
{
int w, h;
int shift = 14, offset1 = 8192, offset2 = 2105344;
int C0 = 1868, C1 = 9617, C2 = 4899, C3 = 11682, C4 = 9241;
int r1,r2,g1,g2,b1,b2;
unsigned char * pRGB1 = imgSrc;
unsigned char * pRGB2 = imgSrc+width*3;
unsigned char * pDY1 = imgDst;
unsigned char * pDY2 = imgDst+width;
unsigned char * pDUV = imgDst+width*height;
for ( h = 0; h < height; h += 2 )
{
for ( w = 0; w < width; w += 2 )
{
b1 = *pRGB1++;
g1 = *pRGB1++;
r1 = *pRGB1++;
*pDY1 = (b1 * C0 + g1 * C1 + r1 * C2 + offset1) >> shift;
*pDUV++ = ((r1 - *pDY1) * C3 + offset2) >> shift;
*pDUV++ = ((b1 - *pDY1) * C4 + offset2) >> shift;
pDY1++;
b1 = *pRGB1+&
最后
以上就是清新板栗为你收集整理的OpenCV | YUV420_NV21 转 BGR的全部内容,希望文章能够帮你解决OpenCV | YUV420_NV21 转 BGR所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复