304564680dsp课程设计无人驾驶车用激光标定螳螂防撞算法的仿真_第1页
304564680dsp课程设计无人驾驶车用激光标定螳螂防撞算法的仿真_第2页
304564680dsp课程设计无人驾驶车用激光标定螳螂防撞算法的仿真_第3页
304564680dsp课程设计无人驾驶车用激光标定螳螂防撞算法的仿真_第4页
304564680dsp课程设计无人驾驶车用激光标定螳螂防撞算法的仿真_第5页
已阅读5页,还剩21页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、 课 程 设 计 报 告课程设计名称: dsp原理及应用 系 别: 三 系 学 生 姓 名: 班 级: 学 号: 成 绩: 指 导 教 师: 开 课 时 间: 2014-2015学年2学期一、课程设计目的 本课程是为通信工程专业本科生开设的必修课,结合学生的专业方向的理论课程,充分发挥学生的主动性,使学生掌握应用matlab 等仿真软件建立基于激光与可见光的无人驾驶车防撞系统,巩固理论课程内容,规范文档的建立,培养学生的创新能力,并能够运用其所学知识进行综合的设计,鼓励2人一组。dsp的课程设计是对自适应dsp控制原理与应用等系统仿真软件、课程学习的综合检验,配合理论课的教学,让学生亲自参加设

2、计、仿真、验证dsp系统的高级处理与控制原理、applications等方面的关键知识点。二、设计任务书无人驾驶车用激光标定螳螂防撞算法的仿真三、进度安排day 1: 图书馆查阅资料,思考总体设计方案, 熟悉软件的编程环境,推荐的参考资料有:matlab工程仿真matlab/simulink系统建模与仿真实例分析tms320c55x dsp library programmers referenceday 2: 总体设计方案的确定与设计day 3: 各部分的具体实现day 4: 程序调试并程序注释day 5: 整理完成设计报告四、具体要求及分工情况要求:a 熟悉matlab的gui desig

3、n。b 熟悉matlab的image边框processc 用手机与激光笔采集样板图序列d simulate电子ptz功能e 用两点定位计算报告第三点的距离f 如果时间多余再做如下试验箱互动g connect with the ti board to make warning sound h user must be able to control the ptz.五、课程设计内容在windows环境下,用matlab搭建图像处理软件,一位同学负责gui的建设,一位同学负责后台算法的建立,用手机预先拍好的激光标定图片序列构建虚拟前进过程,并播报与障碍物的距离,类似螳螂三单眼三维超高速“dma”算

4、法。dsp原理及应用课程设计目 录1、引言12、基本原理22.1 matlab介绍22.2螳螂算法及单目测距原理22.2.1 螳螂算法22.2.2单目测距43、gui design94、实验代码125、测试结果186、总结和展望217、参考文献22211、引言近年来,互联网技术的迅速发展给汽车工业带来了革命性变化的机会。与此同时,汽车智能化技术正逐步得到广泛应用,这项技术使汽车的操作更简单,行驶安全性也更好,而其中最典型也是最热门的未来应用就是无人驾驶汽车。也许这一趋势能使无人汽车比新能源汽车更早走入大众的生活。公共领域示范运营的大环境下,首先选择微型电 动车作为推广突破口, 市场前景广阔,环

5、保、节能效果快速、明显;在使用过程中,通过合理策略可 进一步减低电动汽车的购置和使用成本,提高电动汽车竞争力;最后指出纯电动汽车的有效推广需要构建纯电动汽车友好性社会。纯电动汽车的市场化势必为汽车行业的发展注入新的活力,为国家在低碳经济和后危机时代的经济战略布局取得先机。无人驾驶,是指通过给车辆装备智能软件和 多种感应设备,包括车载传感器、雷达、gps以及摄像头等,实现车辆的自主安全驾驶,安全高效地 到达目的地并达到完全消除交通事故的目标。美国nhtsa(美国国家公路交通安全管理局)分5级定义汽车的自动化等级。 0级:由驾驶员驾驶;1级:具备1种以上自动化控制功能(如自适应巡航和车道保持系统a

6、cc等);2级:以汽车为主体执行多种操作功能;3级:当以汽车为主体的驾驶行不通时可指示驾驶员切换为手动驾驶;4级:完全可以无人驾驶。 如今,越来越多的企业开始涉足这块领域,将尖端的it技术运用到汽车领域中,希望为消费者驾车出行带来更多美好体验。麦肯锡预测,到2025年无人驾驶汽车可以产生2000亿19万亿美元的产值;市场研究公司ihs预测, 2035年4级完全无人驾驶车每年销量可达480万辆。对任何一个行业而言,这都具有足够的市场诱惑。2、基本原理2.1 matlab介绍matlab是美国mathworks公司出品的商业数学软件,用于算法开发、数据可视化、数据分析以及数值计算的高级技术计算语言

7、和交互式环境,主要包括matlab和simulink两大部分。matlab是matrix&laboratory两个词的组合,意为矩阵工厂(矩阵实验室)。是由美国mathworks公司发布的主要面对科学计算、可视化以及交互式程序设计的高科技计算环境。它将数值分析、矩阵计算、科学数据可视化以及非线性动态系统的建模和仿真等诸多强大功能集成在一个易于使用的视窗环境中,为科学研究、工程设计以及必须进行有效数值计算的众多科学领域提供了一种全面的解决方案,并在很大程度上摆脱了传统非交互式程序设计语言(如c、fortran)的编辑模式,代表了当今国际科学计算软件的先进水平。matlab和mathematica

8、、maple并称为三大数学软件。它在数学类科技应用软件中在数值计算方面首屈一指。matlab可以进行矩阵运算、绘制函数和数据、实现算法、创建用户界面、连接其他编程语言的程序等,主要应用于工程计算、控制设计、信号处理与通讯、图像处理、信号检测、金融建模设计与分析等领域。matlab的基本数据单位是矩阵,它的指令表达式与数学、工程中常用的形式十分相似,故用matlab来解算问题要比用c,fortran等语言完成相同的事情简捷得多,并且matlab也吸收了像maple等软件的优点,使matlab成为一个强大的数学软件。在新的版本中也加入了对c,fortran,c+,java的支持。2.2螳螂算法及单

9、目测距原理2.2.1 螳螂算法在所有的动物当中,螳螂躲避攻击对象的反应速度最快,主要是因为螳螂不但有复眼还有单眼,当攻击对象的影像从复眼进入单眼时,单眼负责观察目标变大的速度,随时通知中枢神经逃避目标。根据以上原理,我们选择了含有96个cpu与arm处理器的芯片,96个cpu完成复眼的功能,arm处理器完成单眼的功能。视觉几何计算规避原理图如图1:图1复眼cpu提供径向畸变校正后的图像image(t)和image(t-1),单眼提供features(t-1),同时负责提取features(t),如果feature没有变化,则表示几何视觉距离不变,如果feature有变化,进行motion检测,

10、进行三角几何计算,同时标定聚合最终位置。计算机视觉的基本任务可以归结到测量、识别和重建。为进行视觉计算,必须首先获得空间坐标系与图象坐标系之间的变换关系,即为摄象机建立适当的模型并求解其参数。模型和参数的准确程度直接影响视觉计算的精度。而视觉计算的鲁棒性和可靠性、对源数据及计算条件的误差的容忍度、计算的代价等,都对算法是否能在实际中应用有深刻的影响。三维视觉三角几何计算原理图如图2 图2阴影部分为电子眼的光学轴长(a),b表示障碍的大小与位置,a、b的大小可以根据需要用软件在飞行现场进行长、宽、高的幂比例关系校准与自标定。当单眼在5帧图像里看到变化超过=10个像素,断定目标有变化,复眼的速度是

11、每秒30帧,变化是用最小均方差的方法计算的。计算公式如下:常用的自动规避方法有雷达,超声波,红外线或激光。每种方法都有他各自的优缺点。雷达缺点是由于主动发射电磁波,容易暴露自身,成为对方反辐射导弹的目标,另外也容易被干扰,只要对方采取电子对抗措施,如使用电子干扰或发射干扰弹,就无法正常工作。超声波测距的优点是比较耐脏污,即使传感器上有尘土,只要没有堵死就可以测量,可以在较差的环境中使用,所以倒车雷达多半使用超声波,缺点是精度较低,且成本较高。红外测距的优点是便宜,易制,安全,缺点是精度低,距离近,方向性差。激光测距的优点是精确,缺点是需要注意人体安全,且制做的难度较大,成本较高,而且光学系统需

12、要保持干净,否则将影响测量。所以我们决定选择普通可见光低照度感光传感器作为我们的测距方法。不但可以测量距离还可以识别跟踪目标。2.2.2单目测距车辆的安全系统是智能交通系统的重要组成部分,在危险预警系统、防撞系统等方面发挥着重要的作用,测距技术则是实现这一系统的关键部分。目前,可用于汽车测距主要有超声波测距、毫米波雷达测距、激光测距和视觉测距这四类方式,除去只适合短距离测距的超声波方式,与少则几千,动辄上万的雷达或激光测距仪器相比,视觉测距在成本设备方面有很大的价格优势。目前应用于智能车辆的视觉系统根据摄像机的多少一般分为两种:采用多个摄像机的立体视觉系统及采用单个摄像机的单目视觉系统。立体视

13、觉虽然对于恢复深度信息及确定景物距离比较容易,测量精度高,但是计算速度较慢,成本较大,同时图像配准这一难题的存在缺大大限制了它的应用。单目视觉系统的方法简洁快速,具有更快的图像处理速度和更好的控制实时性,也具有很好的研究和应用前景。(1) 反转透视测距模型摄像机采集图像的过程是从三维欧拉空间到二维欧拉空间的几何变换过程。考虑单目摄像机测距的几何变换过程,如果用i表示三维的现实空间而用w表示图像空间,则图像采集过程是从i到w的过程。测距过程可以被视为这一过程的逆过程,如图1所示 ,车距测量可以认为是利用图像空间w = u,v中的数据 ,在一 定 的 先 验 条 件 下 计 算 现 实 空 间i

14、=x,y,z中 的 一 个 平 面s =(x, y,o)w 上的数据过程。获得了目标车辆底端在图像空间中的纵坐标 u ,还需要获得采集图像的条件和对于图像场景描述的假设。如果包括试点及摄像机的位置,由摄像机在现实空间中的位置 l,d,h表示;视图方向由摄像机中心轴与标准轴的夹角和来表示;摄像机的孔径张角 2 ;摄像机清晰度 m n。以上参数值可通过测量或间接计算获得图3。图3m n射线从摄像机到外界空间,获得图像空间中 (u, v)点的射线在实际间中的角度由(u)和 (v)来确定。其中 u、v 是i空间中的坐标, u = 0, 1,2, ,m1;v=0,1,2,n1。另外,地面上一点p在s平面

15、内到摄像机的地面距离可以通过下一距离公式计算:综合上述因素,得到前车距离的计算公式:该模型利用射线角度的关系建立离图像空间i中的坐标值u, v与现实空间平面 s = ( x, y,o) w 的数据之间的关系。因此 , 获得图像中车辆的像素坐标就可以计算出车辆在s平面中的实际位置图4。图4如果摄像机摄像中心轴与世界坐标系中的 x 轴平行,则和值均为0,计算过称亦可简化为:(2) 基于几何关系的投影模型和摄像机标定的测距算法图像采集是将客观世界的三维场景投影到ccd摄像机(采集器)的二维像平面(ccd光敏矩阵表面)上,这个投影一般采用几何透视变换来描述,其依据小孔成像模型来描述此透视变换,如图5所

16、示。图5 (a)ccd布置示意图 (b)距离测量几何模型其中, f 为ccd摄像机的有效焦距; 为ccd摄像机的俯仰角度;h 为ccd摄像机的安装高度(镜头中ixndao地面的高度);()为光轴与像平面的焦点,作为像平面坐标系的原点,一般取为 (0,0);(x, y)为路面上一点p在像平面上的投影坐标(图3)。在这里,点p就是检测出的前方车辆底部阴影的一点。则根据几何关系得到点p与镜头中心的水平距离d的计算公式如下:(3) 基于逆投影变换的测距算法约束条件:(1)因高速公路坡度较小,故可假设高速公路坡度相同。车道没有太大的弯道,在图像检测范围内,基本呈直道;(2)拍摄位置固定,摄像头垂直于地面

17、,拍摄角度不变。在本模型中,车间距离需要通过摄像图像来得到,即从图像信息出发,解求三维环境汇总物体的空间位置、形状、面积、长度等几何信息,这就要建立物体点和像点之间的关系,需要建立适当的坐标系。由这3个坐标系之间的三角形相似关系可以导出:当焦距 f一定时,实际空间中两车间距与图像前方车辆处的车道宽度的乘积为一常数。距离远近的不同,前车在图中的成像大小也不一样,距离越远,成像越小,距离越近,成像越大,任意两次测量的距离值与成像大小成反比关系,即: 其中: d和d 分别为两次测量的距离(单位:米), w 和 w 为两次测量图像中的车宽(单位:像素)。若已知像大小为w ,则可根据 d = dw/w或

18、 d = d w/w,求得此时的距离d。从式中可知, d w =dw是个常量,记为测量系数 q,这里 ,可以通过多次测量时记录的和和,求出因此,距离公式可定义为: d = qw。式中:d为所求距离(单位:米);w为图中车的宽度(单位:像素);q 为测量系数。3、gui design1、open a new gui in the guide layout editor1. start guide by typing guide at the matlab prompt2. in the guide quick start dialog box, select the blank gui (def

19、ault) template, and then click ok3. display the names of the gui components in the component palette:a. select file preferences guide.b. select show names in component palette.c. click ok.3、layout the simple guide guiadd, align, and label the components in the gui.1. add the three push buttons to th

20、e gui. select the push button tool from the component palette at the left side of the layout editor and drag it into the layout area. create three buttons, positioning them approximately as shown in the following figure.5、label the push buttonseach of the three push buttons specifies a plot type: su

21、rf, mesh, and contour. this topic shows you how to label the buttons with those options.1. select view property inspector.2. in the layout area, click the top push button.3. in the property inspector, select the string property, and then replace the existing value with the word start.4. click outsid

22、e the string field. the push button label changes to start.5. click each of the remaining push buttons in turn andrepeat steps 3 and 4. label the middle push button 3m, the neat button 2m,and the bottom button 1m.6、save the gui layoutwhen you save a gui, guide creates two files, a fig-file and a cod

23、e file. the fig-file, with extension .fig, is a binary file that contains a description of the layout. the code file, with extension .m, contains matlab functions that control the gui behavior.1. save and activate your gui by selecting tools run.2. guide displays a dialog box displaying: activating

24、will save changes to your figure file and matlab code. do you wish to continue?click yes.3. guide opens a save as dialog box in your current folder and prompts you for a fig-file name.4. browse to any folder for which you have write privileges, and then enter the file name simple_gui for the fig-fil

25、e. guide saves both the fig-file and the code file using this name.5. if the folder in which you save the gui is not on the matlab path, guide opens a dialog box, giving you the option of changing the current folder to the folder containing the gui files, or adding that folder to the top or bottom o

26、f the matlab path.4、实验代码function varargout = untitled(varargin)% untitled m-file for untitled.fig% untitled, by itself, creates a new untitled or raises the existing% singleton*.% h = untitled returns the handle to a new untitled or the handle to% the existing singleton*.% untitled(callback,hobject,

27、eventdata,handles,.) calls the local% function named callback in untitled.m with the given input arguments.% untitled(property,value,.) creates a new untitled or raises the% existing singleton*. starting from the left, property value pairs are% applied to the gui before untitled_openingfunction gets

28、 called. an% unrecognized property name or invalid value makes property application% stop. all inputs are passed to untitled_openingfcn via varargin.% *see gui options on guides tools menu. choose gui allows only one% instance to run (singleton).% see also: guide, guidata, guihandles% copyright 2002

29、-2003 the mathworks, inc.% edit the above text to modify the response to help untitled% last modified by guide v2.5 08-jan-2002 15:01:51% begin initialization code - do not editgui_singleton = 1;gui_state = struct(gui_name, mfilename, . gui_singleton, gui_singleton, . gui_openingfcn, untitled_openin

30、gfcn, . gui_outputfcn, untitled_outputfcn, . gui_layoutfcn, , . gui_callback, );if nargin & ischar(varargin1) gui_state.gui_callback = str2func(varargin1);endif nargout varargout1:nargout = gui_mainfcn(gui_state, varargin:);else gui_mainfcn(gui_state, varargin:);end% end initialization code - do not

31、 edit% - executes just before untitled is made visible.function untitled_openingfcn(hobject, eventdata, handles, varargin)% this function has no output args, see outputfcn.% hobject handle to figure% eventdata reserved - to be defined in a future version of matlab% handles structure with handles and

32、 user data (see guidata)% varargin command line arguments to untitled (see varargin)% choose default command line output for untitledhandles.output = hobject;% update handles structureguidata(hobject, handles);% uiwait makes untitled wait for user response (see uiresume)% uiwait(handles.figure1);% -

33、 outputs from this function are returned to the command line.function varargout = untitled_outputfcn(hobject, eventdata, handles) % varargout cell array for returning output args (see varargout);% hobject handle to figure% eventdata reserved - to be defined in a future version of matlab% handles str

34、ucture with handles and user data (see guidata)% get default command line output from handles structurevarargout1 = handles.output;% - executes on button press in pushbutton3.function pushbutton3_callback(hobject, eventdata, handles)filename,pathname=uigetfile(*.jpg;*bmp;*.gif,);%+str=pathname filen

35、ame;%im3=imread(str);%axesaxes(handles.axes3);imshow(im3);% hobject handle to pushbutton3 (see gcbo)% eventdata reserved - to be defined in a future version of matlab% handles structure with handles and user data (see guidata)% - executes during object creation, after setting all properties.function

36、 axes4_createfcn(hobject, eventdata, handles)% hobject handle to axes4 (see gcbo)% eventdata reserved - to be defined in a future version of matlab% handles empty - handles not created until after all createfcns called% hint: place code in openingfcn to populate axes4% - executes on button press in

37、pushbutton7.function pushbutton7_callback(hobject, eventdata, handles) for n=1:3 a=imread(int2str(n),.jpg); axes(handles.axes4); % cut smallirows = size(a,1); % find the lines vertical icolumns = size(a,2); % fine lines horizontalfor m=1:100 scal=1-m/600;rowscutend = round(irows*scal); % after the c

38、ut rowcolumnscutend = round(icolumns*scal); % after the cut columnrowscuthead = irows-round(irows*scal); % after the cut rowcolumnscuthead = icolumns-round(icolumns*scal); % after the cut column acut = a(rowscuthead:rowscutend,columnscuthead:columnscutend,:);pause(0.02); % after cutif n=1 sca=3*scal

39、 sca1=sca+0.0001; endif n=2 sca=2*scal sca1=sca+0.0001; endif n=3 sca=1*scal sca1=sca+0.00001; end imshow(acut);title(距离障碍物,num2str(sca1),m处);endf(n)=getframe;pause(0.05);end% hobject handle to pushbutton7 (see gcbo)% eventdata reserved - to be defined in a future version of matlab% handles structur

40、e with handles and user data (see guidata)% - executes on button press in pushbutton8.function pushbutton8_callback(hobject, eventdata, handles)for n=1:1a=imread(int2str(n),.jpg); %axes(handles.axes4);% cut smallirows = size(a,1); % find the lines verticalicolumns = size(a,2); % fine lines horizonta

41、lfor m=1:100scal=1-m/600;rowscutend = round(irows*scal); % after the cut rowcolumnscutend = round(icolumns*scal); % after the cut columnrowscuthead = irows-round(irows*scal); % after the cut rowcolumnscuthead = icolumns-round(icolumns*scal); % after the cut columnacut = a(rowscuthead:rowscutend,colu

42、mnscuthead:columnscutend,:); pause(0.02); % after cuti=3*scal;ii=i+0.0001;imshow(acut);title(距离障碍物,num2str(ii),m处);endf(n)=getframe;pause(0.05);end% hobject handle to pushbutton4 (see gcbo)% eventdata reserved - to be defined in a future version of matlab% handles structure with handles and user dat

43、a (see guidata)% - executes on button press in pushbutton9.function pushbutton9_callback(hobject, eventdata, handles)for n=2:2a=imread(int2str(n),.jpg); axes(handles.axes4);% cut smallirows = size(a,1); % find the lines verticalicolumns = size(a,2); % fine lines horizontalfor m=1:100scal=1-m/600;row

44、scutend = round(irows*scal); % after the cut rowcolumnscutend = round(icolumns*scal); % after the cut columnrowscuthead = irows-round(irows*scal); % after the cut rowcolumnscuthead = icolumns-round(icolumns*scal); % after the cut columnacut = a(rowscuthead:rowscutend,columnscuthead:columnscutend,:);

45、 pause(0.02); % after cuti=2*scal;ii=i+0.0001;imshow(acut);title(距离障碍物,num2str(ii),m处);endf(n)=getframe;pause(0.05);end% hobject handle to pushbutton4 (see gcbo)% eventdata reserved - to be defined in a future version of matlab% handles structure with handles and user data (see guidata)% - executes on button press in pushbutton12.function pushbutton12_callback(hobject, eventdata, handles)for n=3:3a=imread(int2str(n),.jpg); %axes(hand

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论