毕业论文(设计)基于Matrox 卡的视频图像运动检测30995.doc

上传人:文库蛋蛋多 文档编号:3974131 上传时间:2023-03-30 格式:DOC 页数:9 大小:702.50KB
返回 下载 相关 举报
毕业论文(设计)基于Matrox 卡的视频图像运动检测30995.doc_第1页
第1页 / 共9页
毕业论文(设计)基于Matrox 卡的视频图像运动检测30995.doc_第2页
第2页 / 共9页
毕业论文(设计)基于Matrox 卡的视频图像运动检测30995.doc_第3页
第3页 / 共9页
毕业论文(设计)基于Matrox 卡的视频图像运动检测30995.doc_第4页
第4页 / 共9页
毕业论文(设计)基于Matrox 卡的视频图像运动检测30995.doc_第5页
第5页 / 共9页
点击查看更多>>
资源描述

《毕业论文(设计)基于Matrox 卡的视频图像运动检测30995.doc》由会员分享,可在线阅读,更多相关《毕业论文(设计)基于Matrox 卡的视频图像运动检测30995.doc(9页珍藏版)》请在三一办公上搜索。

1、基于Matrox卡的视频图像运动检测王 宾1,潘建寿1,梁雁冰2(1.西北大学 电子科学系,陕西 西安 710069;2.中国科学院西安光学精密机械研究所 动态目标测控技术研究室, 陕西 西安,710068)摘要:利用Matrox图像采集卡,采用异步缓存方法基本满足了视频图像实时采集和处理的需要,并将处理后的图像数据经适当转换后保存为AVI格式。在此基础上提出了一种改进的运动目标检测算法,实验表明这种方法较Kim方法有更好的检测效果和更快的速度。关键词:图像采集卡;异步缓存采集;运动检测;改进方法中图分类号:TP391.4 文献标识码:A 文章编号:1000-274X(2004)0055-07

2、 对序列图像中运动目标的自动检测与跟踪是计算机视觉研究的重要内容。连续帧间差分法(2帧或3帧)1、背景差分法2,3和光流法4 是目标自动检测的常用方法。连续帧间差分法对于动态环境有很好的适应性,但不能完全提取出目标的所有相关点;背景差分法能够较完整地提取目标点,却又对光照和外部条件造成的动态场景变化过于敏感;光流法虽然能够直接用于摄像机运动下的目标检测,但是大多数光流方法的计算复杂,不适于实时处理。文献5,6提出了一种将连续帧间差分法和背景差法相结合的方法,取得了较好的效果,但还存在着目标轮廓检测的不完整性和目标相关点保留较少的问题。本文在应用Matrox图像采集卡采样得到序列图像的基础上,提

3、出了一种对Kim方法6的改进方法帧差灰度图像匹配加权法,进一步的提高了运动检测的效果。1硬件系统组成本视频图像采集处理系统由CCD摄像机、图像采集卡和计算机系统组成。系统中的图像采集卡采用的是加拿大Matrox公司的Matrox Meteor系列中的标准型Matrox Meteor II Standard,此采集卡支持NTSC/PAL/RS-170/CCIR,彩色/黑白PCI采集,7路视频输入,4MB视频传输缓存,可选MJPEG实时压缩模块,并具有触发功能;通过采集卡上的VIA(Video interface ASIC)可以使图像高速传输到系统主存或其他PCI设备上,最高传输速率可达到132M

4、b/s。采集卡还带有RS-232串行通讯接口,可以实现摄像头的远程控制。为了有效利用此图像采集卡,需要根据系统组成所使用的硬件环境对它进行适当配置,最基本的配置包括制式选择、缓存分配、开发程序包指定等。本系统采用MINTRON 163LP黑白CCD,输出选择CCIR制式,并为图像采集卡分配4Mb/s传输缓存。2软件系统组成软件是系统的灵魂,有效地利用软件不仅可以充分发挥硬件系统的能力,而且可以更加灵活地满足对采集系统各种各样的应用要求。本图像采集系统的软件包括图像处理程序库和应用软件。2.1图像处理程序库和控件库Matrox图像采集卡有着强大的图像处理程序库图像处理和模式识别库(MIL)和MI

5、L的子库MIL-LITE(基本图像处理)。MIL是一个硬件独立的32位图像处理库,利用了Intel的MMX的多媒体图形加速功能对图像处理程序库进行了优化,可以处理二进制、灰度或彩色图像,它是独立于硬件平台的。为了在VB、VC等RAD开发工具中实现快速程序开发,Matrox公司还提供了基于MIL的ActiveX控件库ActiveMIL和子库ActiveMIL-Lite,本控件库可以实现所有MIL的所有功能,而且由于使用了ActiveX控件,所以很大程度上降低了程序设计的难度和开发程序的时间。2.2软件体系结构应用软件的结构如图1所示:图1应用软件体系结构图Fig.1 Structure of a

6、pplication software图像采集程序的基本思路是7:1) 打开通信通道,即确定一个应用对象(Application),并对每个应用对象创建一个或多个系统对象(System)。2) 初始化硬件资源,即为每个系统对象分配数据缓存(Data Buffer)、数据采集器(Digitizer)和数据显示(Display)对象。3)启动采集过程,即将图像读入数据缓存,并将缓存赋值给数组,通过对数组的处理实现对图像的处理,图像数据与数据显示相关联后就可以通过显示控件或窗体显示预处理后的结果。3创建视频处理应用程序中的2个问题3.1异步双缓存采集处理方法Matrox MeteorII图像采集卡支

7、持同步和异步两种采集方式。同步采集方式适用于连续采集显示图像而不做运算处理的情况,这是因为同步采集方式下,在每次采集图像之前,CPU都向采集卡发送采集同步信号,然后等待采集结束,所以在采集过程中CPU由于得不到图像数据而只能处于等待状态。由于CCD仅采集一帧图像就需要40 ms左右,这与人的视觉滞留8大致相当,所以在同步方式下无法保证采集和处理在40 ms内完成,也就无法达到实时处理的要求。异步采集方式下,采集工作和计算机对图像的处理工作可以同时进行,即当CPU处理当前帧的图像时,CCD摄像机可以进行下一帧的图像采集。因此,在程序编制时,需要一个缓存机制用来缓存当前已采集完成的图像和缓存CCD

8、摄像机将要采集或正在采集的图像,从而实现图像采集与处理的并行工作。显然,利用这种双缓存采集方法既可以降低对硬件系统的要求,还可以大大提高系统的处理速度,满足实时处理的要求。计算图像缓存区大小的公式为MemSizeImageWidthImageHeightFrames。实验表明:采用同步采集方式采集288384,每像素8bits的10帧图像大致需要1Mb的缓存空间;采用异步双缓存采集方式采集相同分辨率的图像只需要不到230kb的缓存就可以连续不间断地保存图像。由此可见,使用异步双缓存采集方式不仅可以节约系统资源,而且可以获得更好的采集效果。CExampleDlg:ProcessingWorkFu

9、nction()/采集第一帧图像存在m_GrabImage1中m_Digitizer-Image = m_GrabImage1; m_Digitizer-Grab(); while(!m_StopProcessing&!m_KillProcessing)/采集第2帧m_GrabImage2,处理第1帧/m_GrabImage1ProcessImage(m_GrabImage1);m_Digitizer-Image = m_GrabImage2;m_Digitizer-Grab();m_Image-Copy(m_GrabImage1, imAllBands);/显示第1帧图像/采集第1帧m_Gr

10、abImage1处理第2帧/m_GrabImage2ProcessImage(m_GrabImage2);m_Digitizer-Image = m_GrabImage1;m_Digitizer-Grab();m_Image-Copy(m_GrabImage2, imAllBands); /显示第2帧图像 3.2视频图像数据格式的转换Matrox MeteorII图像采集卡的控件库ActiveMIL7.0由于采用了ActiveX技术,所以采集到的图像的数据格式与一般的图像采集卡不同,它使用了Windows OLE技术中的Variant数组,因此要对采集的图像数据进行处理,就必须对数据格式进行转

11、换。考虑到要使用AVIFileHandler对象将处理完的图像数据保存成AVI格式的视频文件,所以还需要将处理完的图像转换成AVIFileHandler对象支持的数据格式。需要注意的是,从图像采集卡抓取的图像不同于一般BMP图像9,它的图像数据是按列组织,从上到下,从左到右,而BMP图像是按行组织,从左到右,从上到下。下列程序就是基于这种思路处理图像格式转换的。 1)将Variant数据转换成unsigned char型:COleSafeArray MyArray;unsigned char * ModelBuffer;/设置图像数组的大小为SizeX*SizeYDWORD q2=SizeX,

12、SizeY;/建立一个BYTE型的二维数组,/大小为SizeX*SizeYMyArray.Create(VT_UI1,2,q);m_Image-Get(MyArray,imPlanar, imAllBands,0,0,SizeX,SizeY);/将Variant数据指针转换成unsigned char型/数据保存在ModelBuffer中ModelBuffer=(unsigned char*)MyArray.parray-pvData;2)将unsigned char转换成Variant型:long index2;_variant_t ImageArrayVariant;/将处理完的图像(Mo

13、delBuffer)/逐像素保存成Variant数组MyArrayfor(index1=0; index1 SizeY; index1+)for(index0=0;index0Put(ImageArrayVariant,imPlanar, imAllBands,0,0,SizeX,SizeY);MyArray.Attach(ImageArrayVariant.Detach()4图像运动检测应用实例运动检测是利用视频序列图像中的一对连续图像的差,将运动目标从背景图象中分离出来,它包括变化量检测和自适应阈值分割,最终得到序列图像中运动存在与否的一个二值运动模板10。Kim提出的一种运动检测方法6,

14、在利用连续两帧图像差的同时又加入了背景图像差,将两者结合起来,比较精确地提取了二值运动模板。但是,这种方法得到的二值运动模板图像,其目标的内部出现较多被误判为背景的运动信息点,无法形成一个完整的目标轮廓,运动信息点损失较多。本文对Kim方法做了部分改进后得到了较为满意的结果。4.1变化量检测 aKim 方法 b本文方法图22种运动检测模型(其中f1,f2是连续2帧图像,bk是背景图像)Fig. 2 Two models of motion detection如图2,a所示,Kim 方法是分别将连续2帧差图像和背景差图像二值化分割后,再将2幅分割后的二值图像相乘(即相与),最后得到运动检测结果M

15、k,但是Mk(x,y)只是在前边2幅二值图像的(x,y)处同时为非零时才是非零值,即这样得到运动检测图像只包含2幅图像中的共有部分;本文的方法(如图2,b)是将连续2帧差图像和背景差图像直接相乘,再将相乘的结果阈值分割得到运动检测结果,这样就达到了加大了目标信息的权重而抑制了静态背景的效果,所以得到的运动检测图像要比Kim方法得到的图像包含有更多目标的信息,不仅包括目标轮廓而且还有目标轮廓内的目标相关点。比较图2,a和2,b中各处理环节,由于减少了一次二值化过程,因此本方法比Kim将有更快的运算速度。4.2自适应阈值分割本实验系统采用最大类间方差阈值分割11,12法,这种方法是在最小二乘法原理

16、的基础上推导得出的,算法比较简单,使用范围较为广泛。C0和C1类的方差分别是 (1) (2)其中:t为阈值;0,1,0,1分别是C0和C1 类出现概率和均值;L为灰度级。C0和C1类的类间方差为 (3)C0 和C1类的类内方差为 (4)t的等价判决准则 (5)所以,最佳阈值就是 (6)为了去除孤立点和填充空洞,在对图像序列帧差图像阈值分割完成后,进行数学形态学的开、闭运算。运动检测试验结果如图3所示。 a b c d图3运动检测结果Fig . 3Result of motion detection图3中:a,b是一段视频图像列中的两帧连续的图像;c是使用Kim方法的运动检测结果;d是使用本文的

17、方法的运动检测结果。比较图3 c、d可看出,本方法较Kim方法有更好的目标轮廓完整性和目标轮廓内目标相关点的连通性。本实例在普通PC机(Pentium4 1.7G CPU ,128M SDRAM)上运行,视频图像为288384,256级灰度黑白图像,总共采集了460帧。5结论利用Matorx Meteor II图像采集卡,使用异步双缓存采集方法可以实现视频图像的实时连续采集(本实验设为每秒采集25帧视频图像)的要求;使用数据格式转换可以将处理后的数据保存成AVI视频文件;改进后的视频运动目标检测算法,较Kim方法有更好的检测效果和更快的运算速度。参考文献:1 ANDERSON C, BURT

18、P, van der WAL G. Change detection and tracking using pyramid transformation techniques J. In Proceedings of SPIE - Intelligent Robots and Computer Vision, 1985, (579): 72-78.2 HARITAOGLU I, HARWOOD D, DAVIS L S. W4: real-time surveillance of people and their activities J. IEEE Transactions on Patte

19、rn Analysis and Machine Intelligence,2000, 22(8): 809-830.3 WREN C, AZARBAYEJANI A, DARRELL T, et al. Pfinder: Real-time tracking of the human body J. IEEE Transactions on Pattern Analysis and Machine Intelligence,1997, 19(7): 780-785.4 BARRON J, FLEET D, BEAUCHIEMIN S. Performance of optical flow t

20、echniques J. International Journal of Computer Vision, 1994, 12(1): 42-77.5 AMAMOTO N, FUJII A. Detection obstructions and tracking moving objects by image processing techniqueC. Japan: Electronic Communication, 1999, (11): 527-535.6 KIM J B, KIM H J. Efficient region-based motion segmentation for v

21、ideo monitoring system J. Pattern Recognition Letters, 2003, (24): 113-128.7 雷晓峰,王耀南,段 峰. 利用VC+开发图像采集卡与图像预处理库J. 微型机与应用,2002,(1):44-46.8 TEKALP A M. Digital Video Processing M. New Jersey: Prentice Hall, 1995. 9 何 斌,马天予,王运坚,等. Visual C+数字图像处理. 第2版M. 北京:人民邮电出版社,2002.10 贾云得. 机器视觉M. 北京:科学出版社,2002.11 OTS

22、U N. A threshold selection method from gray-level histograms J. IEEE Trans System, Man and Cybernetics, 1979, 9(1): 62-66.待添加的隐藏文字内容312 GUO R, PANDIT S M. Automatic threshold selection based on histogram modes and a discriminant criterion J. Machine Vision and Application, 1998, (10): 331-338. (编辑曹大

23、刚)Video motion detection based on Matrox image cardWANG Bin1, PAN Jian-shou1, LIANG Yan-Bing2(1.Department of Electronic Science, Northwest University, Xian 710069, China; 2. Motion Target Measure & Control technical Lab, Xian Institute of Optics and Precision Mechanics of CAS, Xian 710068, China)Ab

24、stract: The request of real-time grabbing and processing is primarily satisfied by asynchronous buffering method of Matrox imaging card. After converting the format of processed image data, the data may be saved as AVI format file. On the base of it, an improved method of motion detection is put for

25、ward, the experimenting result of this method is better than Kims and this method uses less time than Kims. Keywords: imaging card; asynchronous buffer grabbing; motion detection; improved method 作 者 简 介 王 宾,男,陕西西安人,生于1979年。2001年7月毕业于西北大学电子科学系电子学与信息系统专业,获理学学士学位。毕业后在西北大学电子科学系攻读硕士学位。从事模式识别、图像处理和视频监视方面

26、的研究。Editors note: Judson Jones is a meteorologist, journalist and photographer. He has freelanced with CNN for four years, covering severe weather from tornadoes to typhoons. Follow him on Twitter: jnjonesjr (CNN) - I will always wonder what it was like to huddle around a shortwave radio and through

27、 the crackling static from space hear the faint beeps of the worlds first satellite - Sputnik. I also missed watching Neil Armstrong step foot on the moon and the first space shuttle take off for the stars. Those events were way before my time.As a kid, I was fascinated with what goes on in the sky,

28、 and when NASA pulled the plug on the shuttle program I was heartbroken. Yet the privatized space race has renewed my childhood dreams to reach for the stars.As a meteorologist, Ive still seen many important weather and space events, but right now, if you were sitting next to me, youd hear my foot t

29、apping rapidly under my desk. Im anxious for the next one: a space capsule hanging from a crane in the New Mexico desert.Its like the set for a George Lucas movie floating to the edge of space.You and I will have the chance to watch a man take a leap into an unimaginable free fall from the edge of s

30、pace - live.The (lack of) air up there Watch man jump from 96,000 feet Tuesday, I sat at work glued to the live stream of the Red Bull Stratos Mission. I watched the balloons positioned at different altitudes in the sky to test the winds, knowing that if they would just line up in a vertical straigh

31、t line we would be go for launch.I feel this mission was created for me because I am also a journalist and a photographer, but above all I live for taking a leap of faith - the feeling of pushing the envelope into uncharted territory.The guy who is going to do this, Felix Baumgartner, must have that

32、 same feeling, at a level I will never reach. However, it did not stop me from feeling his pain when a gust of swirling wind kicked up and twisted the partially filled balloon that would take him to the upper end of our atmosphere. As soon as the 40-acre balloon, with skin no thicker than a dry clea

33、ning bag, scraped the ground I knew it was over.How claustrophobia almost grounded supersonic skydiverWith each twist, you could see the wrinkles of disappointment on the face of the current record holder and capcom (capsule communications), Col. Joe Kittinger. He hung his head low in mission contro

34、l as he told Baumgartner the disappointing news: Mission aborted.The supersonic descent could happen as early as Sunday.The weather plays an important role in this mission. Starting at the ground, conditions have to be very calm - winds less than 2 mph, with no precipitation or humidity and limited

35、cloud cover. The balloon, with capsule attached, will move through the lower level of the atmosphere (the troposphere) where our day-to-day weather lives. It will climb higher than the tip of Mount Everest (5.5 miles/8.85 kilometers), drifting even higher than the cruising altitude of commercial air

36、liners (5.6 miles/9.17 kilometers) and into the stratosphere. As he crosses the boundary layer (called the tropopause), he can expect a lot of turbulence.The balloon will slowly drift to the edge of space at 120,000 feet (22.7 miles/36.53 kilometers). Here, Fearless Felix will unclip. He will roll b

37、ack the door.Then, I would assume, he will slowly step out onto something resembling an Olympic diving platform.Below, the Earth becomes the concrete bottom of a swimming pool that he wants to land on, but not too hard. Still, hell be traveling fast, so despite the distance, it will not be like divi

38、ng into the deep end of a pool. It will be like he is diving into the shallow end.Skydiver preps for the big jumpWhen he jumps, he is expected to reach the speed of sound - 690 mph (1,110 kph) - in less than 40 seconds. Like hitting the top of the water, he will begin to slow as he approaches the mo

39、re dense air closer to Earth. But this will not be enough to stop him completely.If he goes too fast or spins out of control, he has a stabilization parachute that can be deployed to slow him down. His team hopes its not needed. Instead, he plans to deploy his 270-square-foot (25-square-meter) main

40、chute at an altitude of around 5,000 feet (1,524 meters).In order to deploy this chute successfully, he will have to slow to 172 mph (277 kph). He will have a reserve parachute that will open automatically if he loses consciousness at mach speeds.Even if everything goes as planned, it wont. Baumgart

41、ner still will free fall at a speed that would cause you and me to pass out, and no parachute is guaranteed to work higher than 25,000 feet (7,620 meters).It might not be the moon, but Kittinger free fell from 102,800 feet in 1960 - at the dawn of an infamous space race that captured the hearts of many. Baumgartner will attempt to break that record, a feat that boggles the mind. This is one of those monumental moments I will always remember, because there is no way Id miss this.

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 办公文档 > 其他范文


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号