24小时热门版块排行榜    

查看: 414  |  回复: 2

easonchanel

新虫 (初入文坛)

[求助] 求教:关于读内存中YUV分量的问题

小弟现在在做一个图像处理方面的工作,算法写好了,但是如何读出来视频采集卡中的数据一直让我很头疼,还请各位大虾帮忙!
//YUV3分量在内存中的地址
fb[src_fbid].bufY = cap_buffers[v4l2_buf.index].offset;
fb[src_fbid].bufCb = fb[src_fbid].bufY + img_size;  
fb[src_fbid].bufCr = fb[src_fbid].bufCb +  
(img_size >> 2);  


char nowY[345600],nowCB[86400],nowCR[86400],backY[345600];
u32 valueY,valueCB,valueCR;

int nWidth,nHeight;
   
/***********************
取出Y分量
***********************/


for(nHeight=0;nHeight<480;nHeight++)
{
for(nWidth=0;nWidth<720;nWidth++)
{
valueY = fb[src_fbid].bufY;
nowY[nHeight*480 + nWidth] = (unsigned char *)valueY;
valueY++;
}
}



/***********************
取出CB分量
**************************/
for(nHeight=0;nHeight<240;nHeight++)
{
for(nWidth=0;nWidth<360;nWidth++)
{
valueCB = fb[src_fbid].bufCb;
nowCB[nHeight*240 + nWidth] = (unsigned char *)valueCB;
valueCB++;
}
}

/*************************
取出CR分量
**************************/
for(nHeight=0;nHeight<240;nHeight++)
{
for(nWidth=0;nWidth<360;nWidth++)
{
valueCR = fb[src_fbid].bufCr;
nowCR[nHeight*240 + nWidth] = (unsigned char *)valueCR;
valueCR++;
}
}





/*********************************
将CB、CR元素赋值为0;
***********************************/

for( nHeight=0;nHeight<240;nHeight++)
{
for(nWidth=0;nWidth<360;nWidth++)
{
nowCB[nHeight*240 + nWidth] = 0;
nowCR[nHeight*240 + nWidth] = 0;
}
}
图像的大小为:720*480,Y、cb、cr的地址已经给出,我想把cb、cr置0,只留Y信号,这样图像就能是黑白灰度图像,但是在板子上运行后,图像没变化,请各位指教啊!
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

easonchanel

新虫 (初入文坛)

这么长时间过去了,此贴仍无人回复~
2楼2013-07-20 13:50:44
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

feixiaolin

荣誉版主 (文坛精英)

优秀版主

学着系统demo走。
3楼2013-07-20 20:18:10
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 easonchanel 的主题更新
信息提示
请填处理意见