【翻译】动态图像监测开源代码 motion 学习-----Motion Guide - Basic Features(motion的基本特性)(一)
说在前面:
我没有经历过专业的翻译培训,也没有丰富的翻译经验,之所以会对Motion这个开源项目的手册进行简单的意思解释,一是因为我要用Motion,二是我对它感兴趣,三是刚好再熟悉一下英语。只是作为以后应用的一个参考,肯定存在很多不足之处,因此,仅供参考!
原文链接 点击打开链接
Motion Guide - Basic Features(基本特性)
This topic consists of the following(子内容) subtopics:CaptureDeviceOptions, MotionDetectionSettings,ImageFileOutput, TuningMotion, MpegFilmsFFmpeg,SnapshotsWebCam, TextFeatures,AdvancedFilenames, ConversionSpecifiers,WebcamServer, RemoteControlHttp,ExternalCommands.
Capture Device Options - The Basic Setup(基本设置)
Before you can start using motion you need to know some basics about your camera. Either you have a camera connected directly to your computer. In this case it is a video4linux type of camera. Or you connect to a network camera using a normal web URL.(让你在运行motion前先了解一下你的相机,是直接连在电脑上的相机还是网络相机,因为不同相机设置不一样)
video4linux (V4L) devices(V4L设备)
Once installed the camera(s) will have the device names /dev/video0, /dev/video1, /dev/video2...
FreeBSD has a different naming of devices. When you build Motion for FreeBSD the default device name is /dev/bktr0. Under FreeBSD a TV card has a special device for controlling the tuner(调谐器) (e.g. /dev/tuner0). The option tunerdevice is only valid when Motion is built and running under FreeBSD. For Linux do not include this option in the config file (remove or comment out).
USB cameras take a lot of bandwidth. (USB相机消耗很多带宽)。A USB camera connected to a USB 1.1 port or hub consumes all the bandwidth. Even with a small framesize and low framerate you should not expect to have more than one camera per USB 1.1 controller. If you need more than 1 USB camera add extra USB PCI cards to your computer. There exists cards that have 4 inputs each with their own controller and with full bandwidth. Many 4-input cards only have 1 controller. USB cameras do not have the feature of selecting input channels. To disable the input selection the option input must be set to the value 8 for USB cameras.(主要将USB相机的限制)
Composite video cards (视频多路复用器)are normally made with a chip called BT878 (older cards have a BT848). They all use the Linux driver called 'bttv'.
There are cards with more then one video input but still only one BT878 chip. They have a video multiplexer(他们有一个视频多路复用器) which input is selected with the config option input. Input channel numbers start at 0 (which is why the value 8 and not 0 disables input selection). There are video capture cards available with 4 or 8 inputs but only one chip. They present themselves as one single video device and you select input using the 'input' option. If you define e.g. 4 thread config files with the same videodevice name but different input numbers Motion automatically goes into round robin mode. See the round robin section for more information. Many TV tuner cards have the input channels: TV Tuner = 0, Standard composite video = 1, S-VHS = 3. Other have TV=0, composite video 1= 1, composite video = 2, S-VHS = 3. For video capture cards input 1 is normally the composite video input.(主要讲视频卡,不太懂)
Some capture cards are specially made for surveillance with for example 4 inputs. Others have a TV tuner, a composite input (phono socket) and perhaps also a S-VHS input. For all these cards the inputs are numbered. The numbering varies from card to card so the easiest is to experiment for 5 minutes with a program that can show the videostream. Use a program such as Camstream or xawtv to experiment with the values.
If you use the TV tuner input you also need to set the frequency of the TV channel using the option frequency. Otherwise set 'frequency' to 0.
Finally you need to set the TV norm. Values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour). Default is 0 (PAL). If your camera is a PAL black and white you may get a better result with norm=3 (PAL no colour).(这几段主要讲TV协调器,也不太懂)
If the netcam_url option is defined all the video4linux options are ignored so make sure the netcam_url option is commented out if you do not need it.(意思是如果选项netcam_url你用不着,那么就把它注释掉,否则所有的video4linux 选项在运行时都会被忽略 )
+++++++video4linux (普通的视频设备)+++++++
These are the parameters used for video4linux devices(video4linux 设备用到的一些参数)
因为参数很多,所以采取用谁看谁的针对性策略。具体参数可看各自的蓝色字体。
auto_brightness(自动亮度)
这个参数取默认值,如果运行后发现所用相机不支持自动亮度调节,再将其配置为on也不迟。
- Type: Boolean
- Range / Valid values: on, off
- Default: off
- Option Topic (详细内容请点击蓝色字体)
brightness(亮度)
- Type: Integer
- Range / Valid values: 0 - 255
- Default: 0 (disabled)
- Option Topic (详细内容请点击蓝色字体)
contrast(对比值)
- Type: Integer(这个地方原文是Boolean,明显是是错误的,应该为Integer)
- Range / Valid values: 0 - 255
- Default: 0 (disabled)
- Option Topic
framerate(帧率)
- Type: Integer
- Range / Valid values: 2 - 100
- Default: 100 (no limit)
- Option Topic
frequency(频率)
- Type: Boolean
- Range / Valid values: 0 - 999999
- Default: 0 (Not set)
- Option Topic
height(图像的高度)
- Type: Integer
- Range / Valid values: Device Dependent
- Default: 288
- Option Topic
Your camera or capture/TV card will not support any picture size. You must know which frame size (width and height) the camera supports. If you do not know start with width 320 and height 240 which most cameras and capture cards supports.(说:你的相机设备不可能支持任何尺寸的图像,所以,你要搞清楚你的相机设备所支持的帧的尺寸,假如你不清楚这些,那么,就把高度和宽度设为大部分相机设备都支持240*320即可)
Motion requires that dimensions of camera image must have both height and width that are a multiple of 16. Thís is normally not a problem. All standard sizes like 640, 480, 352, 320, 288, 240, ...etc are multiples of 16.(这一段话也要注意,说:motion需要相机图像的高度和宽度均为16的倍数,这通常都不是问题。640, 480, 352, 320, 288, 240, ...这些标准的尺寸都是16的倍数。)
hue(图像的色调)
- Type: Integer
- Range / Valid values: 0 - 255
- Default: 0 (disabled)
- Option Topic
Normally only relevant for NTSC cameras.(通常只跟NTSC 的cameras有关)
input(输入通道)
- Type: Integer
- Range / Valid values: 0 - 7, 8 = disabled
- Default: 8 (disabled)
- Option Topic
Input channel to use expressed as an integer number starting from 0. Should normally be set to 1 for video/TV cards, and 8 for USB cameras.(video/TV cards设置为1,USB cameras设置为8)
If you have a video capture card you can define the channel to tune to using this option. If you are using a USB device, network camera or a capture card without tuner you should set the value to the default 8.(如果你用的是video capture card,那么可以用这个选项定义一个通道;如果你用的是 USB device, network camera 或者a capture card without tune,那么就用默认值。)
Many TV tuner cards have the input channels: TV Tuner = 0, Standard composite video = 1, S-VHS = 3. Other have TV=0, composite video 1= 1, composite video = 2, S-VHS = 3. It is recommended to set the parameter to 8 for USB cameras as your first try. For video capture cards input 1 is normally the composite video input.(这段话主要举一些通道设置的例子,不过通常情况下用8就行。)
minimum_frame_time(最小帧时间)
- Type: Integer
- Range / Valid values: 0 - 2147483647
- Default: 0
- Option Topic
norm(规范,通常默认就行,只用于BTTV driver)
- Type: Discrete Strings(离散字符)
- Range / Valid values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour)
- Default: 0 (PAL)
- Option Topic
- Type: Discrete Strings
- Range / Valid values: 0, 90, 180, 270
- Default: 0 (not rotated)
- Option Topic
Note that the CPU load increases when using this feature with a value other than 0. Also note that Motion automatically swaps width and height if you rotate 90 or 270 degrees, so you don't have to touch these options.(
saturation(饱和度)
- Type: Integer
- Range / Valid values: 0 - 255
- Default: 0 (disabled)
- Option Topic
tunerdevice(调谐装置)
- Type: String
- Range / Valid values: Max 4095 characters
- Default: /dev/tuner0
- Option Topic
Make sure to remove or comment out this option when running Motion under Linux.(如果是在Linux下运行motion,请确保删除或者注释掉这个选项)
v4l2_palette(调色板)
- Type: Integer
- Range / Valid values: 0 - 8
- Default: 8
- Option Topic
videodevice(视频设备名称)
- Type: String
- Range / Valid values: Max 4095 characters
- Default: /dev/video0 (FreeBSD: /dev/bktr0)
- Option Topic
The video device to be used for capturing. Default for Linux is /dev/video0. for FreeBSD the default is /dev/bktr0.
This is the video4linux device name. Ignore this for net cameras.
人家说的很清楚,Linux下默认值为/dev/video0,FreeBSD下默认值为/dev/bktr0,所以,不用管它。
width(图像宽度,参考图像高度height)
- Type: Integer
- Range / Valid values: Device Dependent
- Default: 352
- Option Topic
++++++Network Cameras(网络摄像机)+++++++
Motion can connect to a network camera through a normal TCP socket. (Motion可以通过TCP连接到一个网络摄像机)。All you need to give it is the URL. (你要做的是给Motion一个链接)。The URL given must return either one single jpeg picture or an mjpeg stream. For the time being Motion cannot connect to a video stream such a mpeg, mpeg4, divx. The URL must return one single jpeg image or an mjpeg stream! You can connect through a proxy server.When the netcam_url is defined all the video4linux options above are ignored!!(注意:一旦设置了选项netcam_url ,则选项video4linux 中所有的设置都将被忽略)
Note that Motion requires that dimensions of camera image must have both height and width that are a multiple of 16. Thís is normally not a problem. All standard sizes like 640, 480, 352, 320, 288, 240, ...etc are multiples of 16. But if you intend to monitor a network camera which is saving jpeg images you may have to pay attention to the dimensions of the picture.(意思是:如果你用网络摄像机,那么你要特别注意图像尺寸的问题,因为motion要求高度和宽度为16的倍数)
netcam_http(用于保持网络socket)
- Type: Discrete Strings
- Range / Valid values: 1.0, keep_alive, 1.1
- Default: 1.0
- Option Topic
netcam_proxy(网络摄像机代理服务器)
- Type: String
- Range / Valid values: Max 4095 characters
- Default: Not defined
- Option Topic
Use this if you need to connect to a network camera through a proxy server.
Example of syntax: "http://myproxy.mydomain.com:1024
If the proxy port number is 80 you can ommit the port number. Then the syntax is use "http://myproxy.mydomain.com" .
Leave this option undefined if you do not use a proxy server(代理服务器).
主要意思:用的话就定义它,不用的话别管它。
netcam_tolerant_check(简单检查)
- Type: Boolean
- Range / Valid values: on, off
- Default: off
- Option Topic
netcam_url(链接地址)
- Type: String
- Range / Valid values: Max 4095 characters
- Default: Not defined
- Option Topic
Example of URL: http://www.gate.com/pe1rxq/jeroen.jpg.(URL示例)
netcam_userpass(用户权限设置)
- Type: String
- Range / Valid values: Max 4095 characters
- Default: Not defined
- Option Topic
For network cameras protected by username and password, use this option for HTTP 1.1 Basic authentication. The string is specified as username:password. Do not specify this option for no authentication(认证).(意思是不要动它)
To use no authentication simply remove this option from the config file comment it out with "#" or ";" in front.(这里提供两种注释代码的方法,用“#”或者用分号“;”)
++++++Round Robin feature(Round Robin特性)++++++
这种特性也叫轮叫调度,是一种无状态调度。(仅供参考)This feature is automatically activated where multiple threads are sharing the same video device (for example /dev/video0). (当多个线程共享同一个视频设备时,这个特性会被自动激活。)
Round Robin is not relevant for Network cameras or standard USB web cameras. The Round Robin feature is used with video capture cards which have multiple inputs per video chip.(说:这种特性与Network cameras 或standard USB web cameras无关。这种特性用在视频采集卡中,并且一个视频芯片有多个输入。)
These are the special Round Robin options
roundrobin_frames(指定转换输入通道前要采集的帧的数量)
- Type: Integer
- Range / Valid values: 1 - 2147483647
- Default: 1
- Option Topic
roundrobin_skip(指定转换输入通道后要跳过的帧的数量)
- Type: Integer
- Range / Valid values: 1 - 2147483647
- Default: 1
- Option Topic
switchfilter(转换干扰过滤)
- Type: Boolean
- Range / Valid values: on, off
- Default: off
- Option Topic
++++++Motion Detection Settings(Motion检测控制设置)++++++
area_detect(在预定义区域检测运动焦点)
- Type: String
- Range / Valid values: 1 - 999999999
- Default: Not defined
- Option Topic
Example: You want to monitor if the center of motion occurrs in the lower third of the image - that is area 7, 8 and 9. Simply set 'area_detect' to '789' and 'on_area_detect' will be executed as soon as the center of motion was detected in area 7, 8 or 9. If you want to monitor area 2, 3, 5 and 6, set '2356'.(教你定义的方法)
despeckle(去噪)
- Type: String
- Range / Valid values: EedDl
- Default: Not defined
- Option Topic
gap(无运动检测时间间隔,这个选项比较重要)
- Type: Integer
- Range / Valid values: 0 - 2147483647
- Default: 60
- Option Topic
Any motion detected before the gap timer times out resets the gap timer so it starts counting over again.(在间隔结束之前,如果有检测到运动则重置间隔,即用一个新的间隔时间继续检测)
Detailed Description
The option 'gap' is important. It defines how long a period of no motion detected it takes before we say an event is over. An event is defined as a series of motion images taken within a short timeframe. E.g. a person walking through the room is an event that may have caused 10 single jpg images to be stored. Motion detected includes post_captured frames set by the 'post_capture' option. The 'gap' option defines how long a pause between detected motions that is needed to be defined as a new event. A good starting value is 60 seconds.(这段话说gap这个选项很重要,以及gap的具体含义)
Note that 'gap' and 'minimum_gap' have nothing to do with each other.(说:gap和minimum_gap毫无关系)
lightswitch(忽略瞬间亮度发生大量变化的百分比值)
- Type: Integer
- Range / Valid values: 0 - 100
- Default: 0 (disabled)
- Option Topic
mask_file(图像文件绝对路径)
- Type: String
- Range / Valid values: Max 4095 characters
- Default: Not defined
- Option Topic
Full path of the PGM (portable gray map) mask file (binary format).(要使用文件的绝对路径)
If you have one or more areas of the camera image in which you do NOT want motion detected (e.g. a tree that moves in the wind or a corner of the picture where you can see cars/pedestrians passing by) you need a mask file. This file is a picture that you create in your favorite photo editing program. The areas that you want detected must be white. The error that you want ignored must be black. The pgm image must be the same size (number of pixels high and wide) as the pictures that are taken by the camera (video4linux device).(教你怎样设置你要用的pgm文件)
If you do not have a mask file disable this option by not having it in the config file or comment it out ("#"or ";" as first character in line). If you are using therotate
option, note that the mask is applied after the rotation.(如果你不是用该选项,那么把它注释掉)
One easy method for generating the mask file is as follows.(教你一个制作mask file 的简单方法,往下读一下吧)
You can just take a motion captured picture, edit it with black and white for the mask and save it as a pgm file. If you cannot save in this format save as a grayscale jpg and then you can convert it to pgm format with
djpeg -grayscale -pnm [inputfile] > mask.pgm
(assuming you have djpeg installed - part of the jpeg lib package).
Note that the mask file option masks off the detection of motion. The entire picture is still shown on the picture. This means that you cannot use the feature to mask off an area that you do not want people to see.
max_mpeg_time(mpeg视频的最大长度)
- Type: Integer
- Range / Valid values: 0 (infinite) - 2147483647
- Default: 3600
- Option Topic
The maximum length of an mpeg movie in seconds. Set this to zero for unlimited length.(一个mpeg视频的最大长度,以秒计。设为0表示不限制长度)
minimum_motion_frames(不知道该怎么翻译)
- Type: Integer(原文又有错误,原文此处为Boolean)
- Range / Valid values: 1 - 1000s
- Default: 1
- Option Topic
The feature is used when you get many false detections when the camera changes light sensitivity or light changes.(这个特性用在对亮度变化敏感的相机或者亮度发生变化的场合,前提是这种场合出现很多检测错误,否则不用管它。)
Experiment for best setting. Even though Motion accepts large values you should set this to a relatively low number (below 10). For each step larger than 1 Motion reserves space in RAM for the picture frame buffer. If you have a large value Motion will miss many frames from the camera while it is processing the all the pictures in the buffer.(意思还是不要把它的只设置太大,否则会出问题)
noise_level(噪声阈值)
- Type: Integer
- Range / Valid values: 1 - 255
- Default: 32
- Option Topic
This is different from the threshold parameter. This is changes at pixel level. The purpose is to eliminate the changes generated by electric noise in the camera. Especially in complete darkness you can see the noise as small grey dots that come randomly in the picture. This noise can create false motion detection. What this parameter means is that the intensity of a pixel must change more than +/- the noise threshold parameter to be counted.(说:这个值不同于threshold parameter。它是像素级的变化。目的是评估由相机产生的电信号干扰。特别是在全黑的环境下,你能够看到图像有一些随机的灰点。这可能产生错误的运动判断。这个参数是指一个像素密度变化必须多余+/-噪声的threshold parameter值。)
noise_tune(噪音的自动调节)
- Type: Boolean
- Range / Valid values: on, off
- Default: on
- Option Topic
Activates the automatic tuning of noise level.(激活后,自动调整noise_level的值)
This feature makes Motion continuously adjust the noise threshold for distinguishing between noise and motion. The 'noise_level' setting is ignored when activating this feature. This is a new feature and new algorithm. It may give different results depending on camera and light conditions. Report your experience with it on the Motion mailing list. If it does not work well, deactivate the 'noise_tune' option and use the manual setting of 'noise_level' instead.(意思是:这是一种新特性和新算法,激活后,可以自动调整noise_level的值。另外,不同的相机和光线条件可能会有不同的结果。于是,欢迎您做实验然后给反馈以便改进。如果效果不好,请把它关了,然后手动设置noise_level的值。)
output_all(移植输出图像)
- Type: Boolean
- Range / Valid values: on, off
- Default: off
- Option Topic
Picture are saved continuously as if motion was detected all the time.(打开该选项后,如果检测到一直有运动,则一直保存图像。)
This feature is not meant to be the normal mode of operation. Especially not if you have the output_normal or output_motion features enabled since it will keep on saving pictures on the disk and you will soon run out of disk space. So be careful with this command.(意思是,这个选项会耗尽硬盘存储,所以小心使用它,如果确实有需要的话。)
The idea of this feature is that you can turn the feature on and off for a short period of time to test or to generate continuous mpeg films when needed.(告诉你使用该选项的情况)
post_capture(检测到运动后采集帧的数量)
- Type: Integer
- Range / Valid values: 0 - 2147483647
- Default: 0 (disabled)
- Option Topic
Specifies the number of frames to be captured after motion has been detected(检测到运动后采集帧的数量)
The purpose of this is mainly to create smooth video clips each time motion is detected. Use it to you personal taste (and disk space)..(给你说使用目的)
This option is the preferred way to create continuous movies. Post_capture does not consume extra RAM and it does not create pauses in the movie even with large values.(意思是值没有限制)
If you only store mpegs movies and do not have output_normal on, then the recommended post_capture value is what is equivalent to 1-5 seconds of movie.(意思是最好值最好还是小一些~)
pre_capture(输出探测到运动前的帧的数量)
- Type: Integer
- Range / Valid values: 0 - 100s
- Default: 0 (disabled)
- Option Topic
写到这里说一下感受:虽然看motion有点意思,但是一直读英文还要去理解真的不是轻松的事,有种想吐的感觉!不多说了,继续吧!
Specifies the number of previous frames to be outputted at motion detection. Recommended range: 0 to 5, default=0. Do not use large values! Large values will cause Motion to skip video frames and cause unsmooth mpegs. To smooth mpegs use larger values of post_capture instead.(说:这个特性指明输出探测到运动前的帧的数量。推荐值:0~5,默认为0,即不使用此特性。不要使用较大的值!大值会造成Motion失真卡顿。可以使用比较大的post_capture 来得到流畅的mpegs 。)
总之:此特性使得motion好像有预知的能力,其实motion总是缓存一段之前的内容,当探测到运动时,那么就把缓存中的内容加到探测到的运动视频中,这个特性的值就是让你选择motion预知能力的大小。但是值千万不要太大,绝对利大于弊,大值极有可能让你丢掉一些探测到运动后的重要的信息。按着推荐值选择吧!
smart_mask_speed(智能消除干扰运行的特性)
- Type: Integer
- Range / Valid values: 0 - 10
- Default: 0 (disabled)
- Option Topic
这个特性具有自学习的能力,很厉害,用来消除像风吹动树叶这种运动的干扰,建议值为5。
threshold(判断为运动的阈值)
- Type: Integer
- Range / Valid values: 1 - 2147483647
- Default: 1500
- Option Topic
Practical values would be from a few hundred to 2000 indoors and 1000-10000 outdoors.(实际应用中,室内的话取值在几百到2000之间,室外的话取值在1000到10000之间。)
threshold_tune(阈值调节)
- Type: Boolean
- Range / Valid values: on, off
- Default: off
- Option Topic
The threshold setting is ignored when activating this feature. It may give different results depending on your camera, light conditions, indoor/outdoor, the motion to be detected etc. If it does not work well, deactivate the 'threshold_tune' option and use the manual setting of threshold instead.(意思是,如果这个特性被设定了,那么motion将忽略threshold 选项,根据实际情况来决定threshold 值大小。如果你发现设定它之后,motion效果不理想,那么就关了他吧,自己手动设定一个threshold 值。)
Image File Output(图像文件的输出)
The following options controls how Motion generates images when detection motion.
output_motion(输出运动图像,一般不用)
- Type: Boolean
- Range / Valid values: on, off
- Default: off
- Option Topic
output_normal(正常输出,默认就行)
- Type: Discrete Strings
- Range / Valid values: on, off, first, best, center (since 3.2.10)
- Default: on
- Option Topic
ppm
- Type: Boolean
- Range / Valid values: on, off
- Default: off
- Option Topic
ppm(输出ppm格式的图像)
- Type: Boolean
- Range / Valid values: on, off
- Default: off
- Option Topic
quality(图像质量,表示图像压缩的百分比)
- Type: Integer
- Range / Valid values: 1 - 100
- Default: 75
- Option Topic
100 means hardly compressed. A small number means a much smaller file size but also a less nice quality image to look at. 50 is a good compromise for most.(100表示不压缩,一个小值就代表图像的质量稍次,占的存储空间也小。50是一个比好的值。)
++++++Tuning Motion(Motion的调整,这个功能很有意思)++++++
1、With 'motion -s' Motion runs in console mode instead of daemon. It outputs a lot of useful information for each frame from the camera. Each message is prefixed by [number] where number is the camera number (thread number).2、When you look at the mjpeg webcam stream you see a black image with numbers. What you see is the number of changed pixels, number of labeled areas and noise setting. When something moves you see the pixels detected as Motion in black and white. The largest labelled area (assuming despeckle is enabled and with the 'l' at the end) is blue. It is only the blue areas which is counted as Motion. If smartmask is enabled you see this as red areas.
Here is a suggestion how to initially setup Motion.(下面教你怎样开始Motion的设置模式,可以试一下)
- Disable despeckle (comment it out in motion.conf).
- Disable smartmask
- Enable both http control and webcam by setting port numbers. Example 8080 for control and 8081 for webcam.
- Start Motion in setup mode
- View the webcam stream. Either with Cambozola or with Firefox. http://localhost:8081/Firefox often needs to reload the page before it works. Bug in Firefox. Internet Explorer cannot show the stream unless you make a webpage on your Apache with Cambozola applet.
- Open new browser window and connect to the http interface. http://localhost:8080/ . You can now control and change almost anything while Motion is running. You cannot resize the image. That was too hard to code. To disable a feature enter a space.
- Start by experimenting with noise level. Do this both during daylight and during darkness. You will be surprised to see how much noise a camera makes during night. Try using the automatic noise feature. It should work for most.
- Now try the despeckle feature. Enable it using the recommended default EedDl. If this is not enough experiment. Remember that the l must be the last letter. It is fun to play with.
- Set the threshold to what you want to trigger Motion.
In normal mode you can use the same setting with two browser windows and experiment with settings of the camera if needed.
From the web interface you can ask Motion to write all your changes back to the config files (motion.conf and thread config files). It will even tidy them up for you so they look nice.
There are two sets of options to adjust.
- The options that controls the camera device: See CaptureDeviceOptions
- The options that controls the actual motion detection: MotionDetectionSettings