dsp实验报告 2.docx
- 文档编号:12052198
- 上传时间:2023-04-16
- 格式:DOCX
- 页数:31
- 大小:63.37KB
dsp实验报告 2.docx
《dsp实验报告 2.docx》由会员分享,可在线阅读,更多相关《dsp实验报告 2.docx(31页珍藏版)》请在冰豆网上搜索。
dsp实验报告2
DSP图像处理实验报告
组员:
张海星通信1107班
陈淑菁通信1103班
手势识别
1.题目分析
不同的手势出现在屏幕上会显示手势的名字,找出不同手势在屏幕上显示的特点,用这个特点来区分出手势的名称,同时将名称显示在屏幕的左下角。
2.步骤:
(1)找特征:
用运肤色检测的程序调试出来的显示屏幕上图像的特征我们发现肤色的面积大小会随着不同手势透出的皮肤面积的大小而变化,因此我们利用面积的大小来判断不同的手势,并将其名称显示在屏幕的左下角。
(2)采集图像:
我们组用石头和剪刀两个手势。
首先用loop2的显示采集两个手势的图像。
在savedata中保存图像的数据,从程序中找到图像的首地址,保存数据的首地址为:
OX80000000,图像的大小设置为720*288/4。
然后利用matlab程序读图像并计算框的面积大小的值。
读图程序:
%dat文件是由CCS保存的数据文件
%dat文件中每个像素用8bit表示,
%0x245A3654表示第一个像素的值为0x54;第二个像素的值为0x36
%第三个像素的值为0x5A;第四个像素的值为0x24
%本例以图像大小为640*240,请根据你的实际做修改
%在使用本程序前请手动删除dat文件的第一行
clc;clearall;closeall;
imagedata=zeros(720,288);
%-------------------------------低温---------------------------------------
I=importdata('C:
\DocumentsandSettings\Administrator\桌面\s1.dat');
[M,N]=size(I);
fori=1:
720*288/4
a=cell2mat(I(i));
imagedata(i*4)=hex2dec(a(3:
4));
imagedata(i*4-1)=hex2dec(a(5:
6));
imagedata(i*4-2)=hex2dec(a(7:
8));
imagedata(i*4-3)=hex2dec(a(9:
10));
end
imagedata=uint8(imagedata');
imshow(imagedata,[0,720])
用matlab计算面积值的程序:
将图像中手势出现的范围截框,在算出像素点的值就是面积大小。
clc;clear;closeall;
I=imread('C:
\DocumentsandSettings\Administrator\桌面\q1.png');
figure,imshow(I)
I0=imcrop;
figure,imshow(I0)
[l,w]=size(I0);
s=l*w;
计算的结果值:
我们用matlab计算出来的值分别为:
石头:
126420
布:
478296
进行改程序显示不同的名称是用大约的中间值300000进行判断。
(3)程序的修改:
在肤色检测的程序中加入一个判断语句,当框的面积大于300000时显示“布”,否则显示“石”。
读字过程:
我们用取模软件取出字的像素值,然后编程将像素值读入屏幕上,程序如下:
判断模块:
//计算框内总像素点
b=(d-c)*(f-e);
if(b<50000)
h=1;
elseif(b>5000)
h=2;
c=begX;
d=endX;
e=begY;
f=endY;
显示模块:
constunsignedcharshi[]=
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x18,0x3F,0xFF,0xFF,0xFC,0x00,0x07,0x00,0x00,0x00,0x06,0x00,0x00,
0x00,0x06,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x18,0x00,0x00,
0x00,0x18,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x70,0x00,0xC0,
0x00,0xFF,0xFF,0xC0,0x01,0xB0,0x00,0xC0,0x03,0x30,0x00,0xC0,0x06,0x30,0x00,0xC0,
0x0C,0x30,0x00,0xC0,0x18,0x30,0x00,0xC0,0x30,0x30,0x00,0xC0,0x40,0x30,0x00,0xC0,
0x00,0x30,0x00,0xC0,0x00,0x30,0x00,0xC0,0x00,0x3F,0xFF,0xC0,0x00,0x30,0x00,0xC0,
0x00,0x30,0x00,0xC0,0x00,0x30,0x00,0xC0,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00
}
;
constunsignedcharbu[]=
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x80,0x00,
0x00,0x03,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x0C,0x00,0x18,
0x1F,0xFF,0xFF,0xFC,0x00,0x18,0x00,0x00,0x00,0x18,0x40,0x00,0x00,0x30,0x70,0x00,
0x00,0x30,0x60,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x60,0x00,0xFF,0xFF,0xE0,
0x01,0xA0,0x60,0x60,0x03,0x20,0x60,0x60,0x06,0x20,0x60,0x60,0x0C,0x20,0x60,0x60,
0x08,0x20,0x60,0x60,0x30,0x20,0x60,0x60,0x40,0x20,0x60,0x60,0x00,0x20,0x60,0x60,
0x00,0x20,0x60,0x60,0x00,0x20,0x66,0x60,0x00,0x20,0x63,0xE0,0x00,0x20,0x60,0xC0,
0x00,0x00,0x60,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00}
f(test_word&tre_coast)
{
*(Uint8*)(tmpYbuffer+i*numPixels+j)=0x00;
}
else*(Uint8*)(tmpYbuffer+i*numPixels+j)=0xff;
tre_coast=tre_coast<<1;
}
}
num=0;
num=0;
for(i=numLines/2+init_hang;i { for(j=init_lie;j { n=j-init_lie; if(j==init_lie||(n%8==0)) { if(wenzi==1)tre_coast=shi[num]; elseif(wenzi==2)tre_coast=bu[num]; num++; } f(test_word&tre_coast) { *(Uint8*)(tmpYbuffer+i*numPixels+j)=0x00; } else*(Uint8*)(tmpYbuffer+i*numPixels+j)=0xff; tre_coast=tre_coast<<1; } } num=0; num=0; for(i=numLines/2+init_hang;i { for(j=init_lie;j { n=j-init_lie; if(j==init_lie||(n%8==0)) { if(wenzi==1)tre_coast=shi[num]; elseif(wenzi==2)tre_coast=bu[num]; num++; } tre_coast=tre_coast<<1; if(test_word&tre_coast) { *(Uint8*)(tmpYbuffer+i*numPixels+j)=0x00; } else*(Uint8*)(tmpYbuffer+i*numPixels+j)=0xff; } 3.出现的问题 我们发现判断值用300000时,只出现“布”,当判断值用100时,只出现“石”。 我们不断的调试值的大小,最终发现用50000是最合适的值,结果也很正确。 只是屏幕出现的结果显示不太稳定。 而且图像上出现的框变化不是很快,使得结果的出现很慢很不稳定。 图像变化很慢,因为程序要处理大量的像素值,因此反应很慢,处理不连续的点。 4.其他的设计想法 (1)可以不利用肤色检测所圈出的框来判断,直接数出肤色的像素点总数进行判断。 (2)可以用模板匹配法来判断。 (3)可以用边缘检测出白色点的周长来比较判断,因为不同手势的边缘周长不一样。 5.总程序 /********************************************************************/ /*Copyright2004bySEEDIncorporated.*/ /*Allrightsreserved.PropertyofSEEDIncorporated.*/ /*Restrictedrightstouse,duplicateordisclosethiscodeare*/ /*grantedthroughcontract.*/ /**/ /********************************************************************/ #include #include #include #include #include #include #include #include"iic.h" #include"vportcap.h" #include"vportdis.h" #include"sa7121h.h" #include"TVP51xx.h" #include"seeddm642.h" constunsignedcharshi[]= { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x18,0x3F,0xFF,0xFF,0xFC,0x00,0x07,0x00,0x00,0x00,0x06,0x00,0x00, 0x00,0x06,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x18,0x00,0x00, 0x00,0x18,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x70,0x00,0xC0, 0x00,0xFF,0xFF,0xC0,0x01,0xB0,0x00,0xC0,0x03,0x30,0x00,0xC0,0x06,0x30,0x00,0xC0, 0x0C,0x30,0x00,0xC0,0x18,0x30,0x00,0xC0,0x30,0x30,0x00,0xC0,0x40,0x30,0x00,0xC0, 0x00,0x30,0x00,0xC0,0x00,0x30,0x00,0xC0,0x00,0x3F,0xFF,0xC0,0x00,0x30,0x00,0xC0, 0x00,0x30,0x00,0xC0,0x00,0x30,0x00,0xC0,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00 } ; constunsignedcharbu[]= { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x80,0x00, 0x00,0x03,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x0C,0x00,0x18, 0x1F,0xFF,0xFF,0xFC,0x00,0x18,0x00,0x00,0x00,0x18,0x40,0x00,0x00,0x30,0x70,0x00, 0x00,0x30,0x60,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x60,0x00,0xFF,0xFF,0xE0, 0x01,0xA0,0x60,0x60,0x03,0x20,0x60,0x60,0x06,0x20,0x60,0x60,0x0C,0x20,0x60,0x60, 0x08,0x20,0x60,0x60,0x30,0x20,0x60,0x60,0x40,0x20,0x60,0x60,0x00,0x20,0x60,0x60, 0x00,0x20,0x60,0x60,0x00,0x20,0x66,0x60,0x00,0x20,0x63,0xE0,0x00,0x20,0x60,0xC0, 0x00,0x00,0x60,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00 } ; EMIFA_ConfigSeeddm642ConfigA={ 0x00052078,/*gblctlEMIFA(B)globalcontrolregistervalue*/ /*将CLK6、4、1使能;将MRMODE置1;使能EK2EN,EK2RATE*/ 0xffffffd3,/*cectl0CE0spacecontrolregistervalue*/ /*将CE0空间设为SDRAM*/ 0x73a28e01,/*cectl1CE1spacecontrolregistervalue*/ /*Readhold: 1clock; MTYPE: 0000,选择8位的异步接口 Readstrobe: 001110;14个clock宽度 TA: 2clock;Readsetup2clock; Writehold: 2clock;Writestrobe: 14clock Writesetup: 7clock ----------------- \14c/1c \----------------/*/ 0x22a28a22,/*cectl2CE2spacecontrolregistervalue*/ 0x22a28a42,/*cectl3CE3spacecontrolregistervalue*/ 0x57115000,/*sdctlSDRAMcontrolregistervalue*/ 0x0000081b,/*sdtimSDRAMtimingregistervalue*/ 0x001faf4d,/*sdextSDRAMextensionregistervalue*/ 0x00000002,/*cesec0CE0spacesecondarycontrolregistervalue*/ 0x00000002,/*cesec1CE1spacesecondarycontrolregistervalue*/ 0x00000002,/*cesec2CE2spacesecondarycontrolregistervalue*/ 0x00000073/*cesec3CE3spacesecondarycontrolregistervalue*/ }; I2C_ConfigSEEDDM642IIC_Config={ 0,/*mastermode,i2coar;采用主模式*/ 0,/*nointerrupt,i2cimr;只写,不读,采用无中断方式*/ (20-5),/*scllowtime,i2cclkl;*/ (20-5),/*sclhightime,i2cclkh;*/ 1,/*configurelater,i2ccnt;*/ 0,/*configurelater,i2csar;*/ 0x4ea0,/*mastertxmode,*/ /*i2crunsfree,*/ /*8-bitdata+NACK*/ /*norepeatmode*/ (75-1),/*4MHzclock,i2cpsc*/ }; CHIP_ConfigSEEDDM642percfg={ CHIP_VP2+\ CHIP_VP1+\ CHIP_VP0+\ CHIP_I2C }; I2C_HandlehSeeddm642i2c; intportNumber; externSA7121H_ConfParamssa7121hPAL[45]; externSA7121H_ConfParamssa7121hNTSC[45]; Uint8vFromat=0; Uint8misc_ctrl=0x6D; Uint8output_format=0x47; //地址为0forcvbsport1,选择复合信号做为输入 Uint8input_sel=0x00; /*地址为0xf,将Pin27设置成为CAPEN功能*/ Uint8pin_cfg=0x02; /*地址为1B*/ Uint8chro_ctrl_2=0x14; /*图像句柄的声明*/ VP_HandlevpHchannel0; VP_HandlevpHchannel1; VP_HandlevpHchannel2; /*确定图像的参数*/ intnumPixels=720;//每行720个像素 intnumLines=576;//每帧576行(PAL) doublea=0; doubleb=0; intc=0; intd=0; inte=0; intf=0; inth=0; doubleg=0; voidNAME(intinit_lie,intinit_hang,intwenzi); /*采集与显示缓冲区的首址*/ Uint32capYbuffer=0x80000000; Uint32capCbbuffer=0x800675c0; Uint32capCrbuffer=0x8009b0a0; //Uint32capCbbuffer=0x6190; //Uint32capCrbuffer=0x6190; Uint32disYbuffer=0x80100000; Uint32disCbbuffer=0x801675c0; Uint32disCrbuffer=0x8019b0a0; Uint32tmpYbuffer=0x80200000; Uint32tmpCbbuffer=0x802675c0; Uint32tmpCrbuffer=0x8029b0a0; Uint32dstYbuffer=0x80300000; /*图像格式标志*/ Uint8NTSCorPAL=0; externfarvoidvectors(); externvolatileUint32capNewFrame; externvolatileUint32disNewFrame; /*此程序可将四个采集口的数据经过VideoPort0送出*/ voidmain() { Uint8addrI2C; inti,j,n; //intmaxrow; intpixelnum,curnum; intbegX,endX,begY,endY; /*-------------------------------------------------------*/ /*performallinitializations*/ /*-------------------------------------------------------*/ /*InitialiseCSL,初始化CSL库*/ CSL_init(); CHIP_config(&SEEDDM642percfg); /*----------------------------------------------------------*/ /*EMIFA的初始化,将CE0设为SDRAM空间,CE1设为异步空间 注,DM642支持的是EMIFA,而非EMIF*/ EMIFA_config(&Seeddm642ConfigA); /*----------------------------------------------------------*/ /*中断向量表的初始化*/ //PointtotheIRQvectortable IRQ_setV
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- dsp实验报告 dsp 实验 报告
![提示](https://static.bdocx.com/images/bang_tan.gif)