当h为1时,显示“王”字,h为2时,显示“黄”字,h为3时,显示“无”字。
本程序,我们定义的字体的大小为32*32,数组中每一个八位二进制数值对应八个像素点,每次判断八位数值中的一位,当其为1时,在屏幕上显示黑色,为0时显示白色。
void NAME(int init_lie, int init_hang,int wenzi) {
unsigned int i=0,j=0, num=0,n=0; //static unsigned int num;
unsigned char test_word=0x80,tre_coast=0x00; //while(F16x16[num]!='\\0')
for(i=init_hang;i for(j=init_lie;j n=j-init_lie; if(j==init_lie||(n%8==0)) { if(wenzi==1) tre_coast=wang[num]; else if(wenzi==3) tre_coast=WU[num]; else if(wenzi==2) tre_coast=huang[num]; num++; } if(test_word&tre_coast) { *(Uint8 *)(tmpYbuffer + i*numPixels + j) = 0x00; } else *(Uint8 *)(tmpYbuffer + i*numPixels + j) = 0xff; tre_coast=tre_coast<<1; } } num=0; for(i=numLines/2+init_hang;i for(j=init_lie;j n=j-init_lie; 8 } } } if(j==init_lie||(n%8==0)) { if(wenzi==1)tre_coast=wang[num]; else if(wenzi==2)tre_coast=huang[num]; else if(wenzi==3)tre_coast=WU[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; 5 实验结果 6 实验感想 为期半个学期的DSP课程的学习就此告一段落,通过此次结课设计,我们利用所学知识,最终克服困难实现了。总体来讲,我们收获颇丰。 首先,通过此次结课设计,我们又进一步掌握利用DSP进行图像处理的方法,了解利用仿真软件以及实验箱的对DSP图像的相关设计过程,特别是实验中所实现的图像二值化、人脸捕捉,画边框,显示名字等功能,无不体现着课堂中所学关于图像采集、阈值分割以及图像处理的相关知识,可以说这次结课设计就是对这半个学期所学内容的很好总结。 其次,此次设计我们并非一帆风顺,我们选择题目以后,收集了多方面的资料进行查阅,并及时交流讨论,通过这个过程,我们对所学知识有了更加多面的理解。比如关于奇偶场图像处理这一块,上课的时候虽然老师给过例程,但是通过我们查找的很多资料进行参考后有了更加简单的算法,可以说这给予了我们的学习的动力。总之,结合着我们的所学理论知识,我们对于本次设计所用的相关知识有了更加深入的理解。 当然,通过这次研讨,我们也存在着遗憾,那就是关于程序在BIOS上的实现还没有完成。我们曾经做过尝试,因为考虑到BIOS是个更加底层的系统,它更面向硬件,因此处理速度更快。但是,我们却遇到了诸如不能合适地建立临时缓存区这个问题,我们也请教过老师,但是由于所学知识的局限性以及设计截止日期的紧迫性,我们最终还是选择不在BIOS 9 上实现了。通过此课程的学习我们已经对DSP图像处理萌生了兴趣,在今后的学习中我们一定会在多做尝试。 最后,衷心感谢高海林老师长达半个学期的实验讲授以及对本设计的指导! 7 附录 /********************************************************************/ /* Copyright 2004 by SEED Incorporated. /* All rights reserved. Property of SEED Incorporated. */ /* Restricted rights to use, duplicate or disclose this code are */ /* granted through contract. */ /* /********************************************************************/ #include #include #include \#include \ 10 */ */ #include \#include \#include \ const unsigned char WU[]= { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0xE0, 0x0F,0xFF,0xFF,0xF0,0x04,0x03,0x80,0x00,0x00,0x03,0x80,0x00,0x00,0x03,0x80,0x00, 0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x10, 0x00,0x03,0x00,0x38,0x3F,0xFF,0xFF,0xFC,0x30,0x03,0x60,0x00,0x00,0x03,0x60,0x00, 0x00,0x07,0x60,0x00,0x00,0x06,0x60,0x00,0x00,0x06,0x60,0x00,0x00,0x0E,0x60,0x00, 0x00,0x0C,0x60,0x00,0x00,0x0C,0x60,0x00,0x00,0x18,0x60,0x08,0x00,0x38,0x60,0x08, 0x00,0x30,0x60,0x08,0x00,0x60,0x60,0x08,0x00,0xC0,0x60,0x0C,0x03,0x80,0x60,0x1E, 0x07,0x00,0x7F,0xFC,0x1C,0x00,0x3F,0xF8,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }; /*---------------黄----------------*/ const unsigned char huang[]= { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x18,0x1C,0x00, 0x00,0x18,0x18,0x00,0x00,0x18,0x18,0x70,0x0F,0xFF,0xFF,0xF0,0x00,0x18,0x18,0x00, 0x00,0x18,0x18,0x00,0x00,0x18,0x18,0x18,0x7F,0xFF,0xFF,0xFC,0x3F,0xFF,0xFF,0xFE, 0x00,0x01,0x80,0x00,0x01,0x01,0x80,0x80,0x01,0xFF,0xFF,0xC0,0x01,0x81,0x81,0xC0, 0x01,0x81,0x81,0x80,0x01,0x81,0x81,0x80,0x01,0x81,0x81,0x80,0x01,0xFF,0xFF,0x80, 0x01,0x81,0x81,0x80,0x01,0x81,0x81,0x80,0x01,0x81,0x81,0x80,0x01,0xFF,0xFF,0x80, 0x01,0x98,0x01,0x80,0x00,0x3C,0x1C,0x00,0x00,0x78,0x07,0x80,0x00,0xE0,0x03,0xE0, 0x03,0x80,0x00,0xF0,0x0E,0x00,0x00,0x70,0x18,0x00,0x00,0x30,0x00,0x00,0x00,0x00, }; /*---------------王----------------*/ const unsigned char wang[]= { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x70,0x0F,0xFF,0xFF,0xF8,0x00,0x01,0x80,0x00, 0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00, 0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00,0x00,0x01,0x80,0xC0, 0x07,0xFF,0xFF,0xE0,0x03,0xFF,0xFF,0xE0,0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00, 0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00, 0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x18, 0x3F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; EMIFA_Config Seeddm642ConfigA ={ 0x00052078,/*gblctl EMIFA(B)global control register value */ 11