视频监控系统在智能家居中的应用
中国安防行业网    2013/10/22 15:02:00    关键字:视频监控系统,智能家居      浏览量:

  本文即是在视频服务器端运行Servfox服务器端程序,通过80211b无线网卡将视频信息发送到作为监控中心的PC机上,而Pc机上运行Spcaview客户机端程序,实现在客户机端定时、实时截图,保存视频信息等工作,从而在视频信息中技现可疑入侵,实现安防功能。系统C/S架构如图3-I所示:

  3.2.1 Vide04Linux简介

  Vide04Linux是Linux内核里支持影像设备的一组APIs,配合适当的视频采集设备和相应的驱动程序,可以实现影像采集、AM/FM广播、频道切换等功能,

  在远程会议、可视电话、视频监控系统中有着广泛的应用。

  在Linux下,所有外设都被看成是一种特殊的文件,称之为设各文件。系统调用是内核和应用程序之间的接口,而设备驱动程序则是内核和外设之间的接口,它完成设备的初始化和释放、对设备文件的各种操作和中断处理等功能,因为应用程序屏蔽了外设硬件的细节,使得应用程序可以像普通文件一样对外设进行操作。本系统中主要针对USB摄像头设备idev/videoO,进行视频图像采集方面的程序设计。

  Linux下V4L视频采集,主要是调用V4L模块参数进行视频原始数据的采集。使用的一些主要参数和函数定义在系/include/iinux/videodev h文件中,这里就编程中经常使用的数据结构作出说明㈣。

  ●strucI video_capability包含设备的基本信息(设备名称、支持的最大摄小

  分辨率、信号源信息等)

  name Canonical name for this interface

  type Hpe of imerface

  channels Number of radioltv channelsifappropriate

  audios Number of audio devices ifappropriate

  maxwidth Maximumcapturewidth inpixels

  maxheight Maximumcapture heightinpixels

  minwidth Minimumcapturewidth inpixels

  minheight Minimumcapture heightinpixels

  ·struct videopicture包含设备采集的图象的各种属性(亮度、色调、对比度、色度、深度等)

  brigtness Picturebrightness

  hue Picturehue(colour only)

  colour Picturecolour(colour only)

  contrast Picture contrast

  whiteness Thewhiteness(greyscale only)

  depth Thecapture depth(matchthe frame bufferdepth)

  ·structvideo channel包含关于各个信号源的属性(信号源个数、设备名称、标志位等)

  channelne channel number

  name The input name—preferably reflectingthe label on the card input it self

  tuners Number of tunersforthis input

  flags Propertiesthe tuner has

  type Type VIDEO_TYPE_TVIIDEO_TYPE_CAMERA

  norm The norm for this channelPALINSTCISECAMIAUTO

  ·truct video window包含关于视频捕获区域(capture area)的信息

  x The X co-ordinate specifiedin X windows format

  Y The Yco-ordinatespecifiedin X windows format

  width The width oftheimage capture

  height The heightofthe image captHie

  chromakey A host order RGB32value forthe chromakey

  flags Additionalcapture flags

  clips list ofclipping rectangles.(Set only)

  clipcount Thenumber ofclippingrectangles.(Set only)

  ·struct videombuf利用mmap进行映射的帧的信息

  size he number ofbytestomap

  frames The number of frames

  ffsets The offset&each frame

  ·structvideommap用于mmap

  在V4L编程中,与图像设备的交互主要是依靠系统调用Ioctl函数来实现的,Ioctl主要用来控制I/O通道。Ioctl0通常需要几个参数,一般情况下,第一个参数fd代表打开的文件/设备;第二个参数cmd为驱动程序的特殊命令;有的还有第3个或者更多的参数,根据不同的驱动程序而不同。在V4L中还定义了一些重要的宏,用来作为loctl函数的第二个参数,用来操纵设备,一些主要的宏定义说明如下:

  ·VIDIOCGCAP:Ioctl操作得到图像设备的基本信息,保存在videocapability结构体中。

  ·VIDIOCSCAP:Ioctl操作根据video结构体中的值来设置图像_capability设备初始参数。

  ·VIDIOCGPICT:Ioctl操作得到图像的基本信息,保存在video picture结构体中。

  ·IDIOCSPICT:Ioctl操作根据video picture结构体中的值来设置采集图像的初始参数。

[1] [2] [34 [5] [6