【翻译】动态图像监测开源代码 motion 学习-----Motion Guide - Basic Features(motion的基本特性)(二)


【翻译】动态图像监测开源代码 motion 学习-----Motion Guide - Basic Features(motion的基本特性)(二)


说在前面:

我没有经历过专业的翻译培训,也没有丰富的翻译经验,之所以会对Motion这个开源项目的手册进行简单的意思解释,一是因为我要用Motion,二是我对它感兴趣,三是刚好再熟悉一下英语。只是作为以后应用的一个参考,肯定存在很多不足之处,因此,仅供参考!

原文链接  点击打开链接


Motion Guide - Basic Features(基本特性)


Generating MPEG films with ffmpeg(用ffmpeg产生MPEG影片)


简单介绍:
FFmpeg在Linux平台下开发,但它同样也可以在其它操作系统环境中编译运行,包括Windows、Mac OS X等。这个项目最早由Fabrice Bellard发起,现在由Michael Niedermayer维护。许多FFmpeg的开发人员都来自MPlayer项目,而且当前FFmpeg也是放在MPlayer项目组的服务器上。项目的名称来自MPEG视频编码标准,前面的"FF"代表"Fast Forward"。
FFmpeg是一套可以用来记录、转换数字音频、视频,并能将其转化为流的开源计算机程序。它包括了目前领先的音/视频编码库libavcodec。 FFmpeg是在Linux下开发出来的,但它可以在包括Windows在内的大多数操作系统中编译。这个项目是由Fabrice Bellard发起的,现在由Michael Niedermayer主持。可以轻易地实现多种视频格式之间的相互转换,例如可以将摄录下的视频avi等转成现在视频网站所采用的flv格式。
Some people on the Motion mailing list have had trouble building the ffmpeg package because they did not have the NASM assembler package installed. So pay attention to this if you run into problems.(有些人在邮件中说在编译ffmpeg包时遇到了问题,原因是他们没有安装NASM包。所以,当你遇到这个问题时注意一下)
Ffmpeg is an interesting project. The releases have not been very consistent over time. The official releases are out of date now. So we are forced to take our chance and checkout a version from their CVS server and hope that we are lucky in getting a version that works. See ffmpeg project page. We encourage the maintaners of such an important project to introduce better release schedules in the near future for the benefit of opensource software.(这段话首先对ffmpeg这个开源项目进行赞美,然后说这个项目已经被搁置,迫切希望维护者能开发出更好的发行版本,不要让这好的开源项目浪费了)
Motion works with the following versions of ffmpeg(和Motion适配的ffmpeg版本):
  • ffmpeg-0.4.8. With this release Motion supports mpeg1, mpeg4 and msmpeg4. Lately newer distributions have problems building this 2003 release of ffmpeg so many of you no longer have this option.
  • ffmpeg-0.4.9pre1. Is supported starting from Motion version 3.1.18. With this release Motion supports mpeg4 and msmpeg4 but not mpeg1. The reason is that the ffmpeg team has decided no longer to support non-standard framerates in their mpeg1 encoder library. Also ffmpeg-0.4.9pre1 gives people problems on newer distributions.
  • ffmpeg from CVS. This may work. We cannot continuously monitor and try every time a new source file is checked into ffmpeg. You will have to try.
  • ffmpeg RPMs. Currently each Motion release is tested with the current Livna ffmpeg rpm package for Fedora. See the Download Filespage for direct links to the version which has been certified with the latest Motion release.
  • ffmpeg debian binaries. Latest versions from the debian repository for Debian Sarge works fine with Motion.
  • Certified ffmpeg CVS snapshot for latest Motion release is available from the Motion Sourceforge Related Projects file area
In principle Motion can be made to support many other formats. It requires additional coding in Motion. You are welcome to submit patches. All ffmpeg related code is in the source file ffmpeg.c. It is not trivial to do because the ffmpeg libraries not documented at all. All you have is a couple of code examples.(主要告诉你欢迎你向Motion提交支持其他编码格式的补丁。另外,你下载到的ffmpeg只是一个ffmpeg的c文件,你得到的只是一些编码的例子)

To build ffpmeg from source follow these steps:(下面就教你怎样编译ffmpeg)

Download the ffmpeg and untar it to /usr/local/ffmpeg. Then it should be a simple matter of entering the ffmpeg directory and run the commands(首先下载ffmpeg然后解压到/usr/local/ffmpeg.。接下来就是进入ffmpeg目录,然后执行下面的命令
cd /usr/local/ffmpeg
./configure --enable-shared
make
make install

This creates the libavcodec.so and libavformat.solibraries under /usr/local/lib and header files under /usr/local/include/ffmpeg.(告诉你生成了哪些文件,文件在哪里)

You probably need to do one more step.(你还要做完一下步骤)

Make sure you have 'root' privileges for the next steps.(在下面的步骤里,确保你拥有了root权限)

Open the file /etc/ld.so.conf in your favorite text editor.(用你最喜欢的编辑器打开文件/etc/ld.so.conf

Add this line of text if it is not already there - otherwise go to the next step (ldconfig).(如果文件中没有下面这行,那么加上它,否则,执行下一步(ldconfig))

/usr/local/lib
Run the command ldconfig.

Motion should now be able to find the shared libraries for ffmpeg (libavcodec.so and libavformat.so) in/usr/local/lib.

下面另一种方法安装ffmpeg(用rpm包安装):

You can also find a pre-compiled binary package (e.g. rpm or deb) and install this. Normally an rpm will place the libavcodec.so under /usr/lib. There are various RPMs available from different repositories. Some need additional RPMs that are actually not needed by Motion but need to be installed to satisfy dependencies. The editor has tried different RPMs of ffmpeg-0.4.8 and they all seem to work.

Motion then need to be built by running ./configure,make and make install. ((接下来就是从新配置和安装motion。分别执行:./configuremake 和 make install)。Note that with earlier versions of motion you had to specify the location of libavcodec. Now configure searches for the shared library in /usr/lib and /usr/local/lib by default.)

Note that if you install ffmpeg from source and already have ffmpeg installed from an RPM, the Motion configure may very well find the binary library from the rpm instead of the sources. Make sure to uninstall any old ffmpeg RPMs before you install ffmpeg from sources.(提示你如果你在已经用rpm方式安装了ffmpeg情况下去安装源码方式ffmpeg,那么motion会从rpm找到二进制库而不是从源码方式中找。确保在安装源码方式的ffmpeg时,把旧的rpm版的ffmpeg卸掉。)


提示:
从此处之后只对每个选项中我认为比较重要的段落进行意思解析,提示需要注意的地方,不会再出现对整段进行翻译的情况,除非是我认为很重要的地方。而且每段的意思解析都会紧跟在该段之后(这样更清晰),如果某段没有意思解析,则说明该段不重要或者我也理解不了,如果需要详细的内容请点击文章开头的源码链接自行翻阅。(为了简单,文中的   “说:”  代表  “意思是:”,再直白一点就是 “作者要告诉你的是:” )

These are the config file options related to ffmpeg.(下面是与ffmpeg相关的配置选项)

ffmpeg_bps(ffmpeg比特率)

  • Type: Integer
  • Range / Valid values: 0 - 9999999
  • Default: 400000
  • Option Topic
Bitrate of mpegs produced by ffmpeg. Bitrate is bits per second. Default: 400000 (400kbps). Higher value mans better quality and larger files. Option requires that ffmpeg libraries are installed.
意思是:mpegs的比特率按秒计算。默认值是400000,即400kbps。值越大图像质量越好同时也意味着产生的文件也越大。用这个选项有一个前提:你已经安装饿了ffmpeg库。

To use this feature you need to install the FFmpeg Streaming Multimedia System.
告诉你:要使用这个特性你需要安装 FFmpeg Streaming Multimedia System

Experiment to get the desired quality. The better quality the bigger files. This option is ignored if ffmpeg_variable_bitrate is not 0 (disabled).
说:你可以多次尝试得到想要的值。如果ffmpeg_variable_bitrate 没有被disabled,则这个选项将被忽略。

ffmpeg_cap_motion

  • Type: Boolean
  • Range / Valid values: on, off
  • Default: off
  • Option Topic

Use ffmpeg libraries to encode motion type mpeg movies where you only see the pixels that changes.

Works like ffmpeg_cap_new but outputs motion pixel type pictures instead.
说:和ffmpeg_cap_new 类似,只是输出图像的格式不同,为像素图片

This feature generates the special motion type movie where you only see the pixels that changes as a graytone image. If labelling is enabled you see the largest area in blue. Smartmask is shown in red. The filename given is the same as the normal mpegs except they have an 'm' appended after the filename before the .mpg. E.g. 20040424181525m.mpg

To use this feature you need to install the FFmpeg Streaming Multimedia System
说:使用这个选项你需要安装FFmpeg Streaming Multimedia System。

ffmpeg_cap_new

  • Type: Boolean
  • Range / Valid values: on, off
  • Default: off
  • Option Topic

Use ffmpeg libraries to encode mpeg movies in realtime.

Generates a new film at the beginning of each new event and appends to the film for each motion detected within the same event. The current event ends when the time defined by the 'gap' option has passed with no motion detected. At the next detection of motion a new mpeg film is started.

To use this feature you need to install the FFmpeg Streaming Multimedia System
说:使用这个选项你需要安装FFmpeg Streaming Multimedia System。

Must not be included in config file without having ffmpeg installed.
说:如果没有安装ffmpeg,一定不要在配置文件motion.conf中包含它。

ffmpeg_deinterlace(ffmpeg隔行扫描)

  • Type: Boolean
  • Range / Valid values: on, off
  • Default: off
  • Option Topic

Use ffmpeg to deinterlace(隔行扫描) video. Necessary if you use an analog(模拟) camera and see horizontal combing on moving objects in video or pictures.

To use this feature you need to install the FFmpeg Streaming Multimedia System
说:使用这个选项你需要安装FFmpeg Streaming Multimedia System。

Must not be included in config file without having ffmpeg installed.
说:如果没有安装ffmpeg,一定不要在配置文件motion.conf中包含它。

知识补充:

一个动态影像是由一连串连续的静态影像所组成的,其中每一个静态影像称为帧(frame),而动态影像中每秒所包含静态影像的数量则称为帧(速)率(frame per second, fps)。

而在显示器上显示动态影像的方式有两种:

  • 渐进扫描:或称为逐行扫描。将每一帧从左至右、由上至下,逐一的将所有的画素显示出来。
  • 交错扫描:或称为隔行扫描。将一帧图像的奇数行画素及偶数行画素分开,分成为两个场(field)。轮流扫描奇数行所构成的场及偶数行所构成的场。

因为一个场只有一个帧一半的资讯,因此在装置处理速度无法即时的处理整个帧的资讯以及传输带宽不够即时传输整个帧的情形下,使用交错扫描可以节省一半的资讯量且可以为持相同的更新率。


ffmpeg_timelapse(时间推移)

  • Type: Boolean
  • Range / Valid values: 0 - 2147483647
  • Default: 0 (disabled)
  • Option Topic

Create a timelapse movie saving a picture frame at the interval in seconds set by this parameter. Set it to 0 if not used.

This feature uses ffmpegs libavcodec to encode a timelaps movie saving a picture frame at the interval in seconds set by this parameter. Setting this option to 0 disables it.

The feature gives your viewer the chance to watch the day pass by. It makes a nice effect to film flowers etc closeup during the day. Options like frame_rate, snapshot, gap etc have no impact on the ffmpeg timelapse function.

Note that the timelapse format is always mpeg1 independent of ffmpeg_video_codec. This is because mpeg1 allows the timelapse to stop and the file to be reopened and more film appended.
说:timelapse 的格式总是mpeg1 ,而且独立于ffmpeg_video_codec。这是因为mpeg1允许timelapse 停止,重新打开文件并增加更多影片信息。

To use this feature you need to install the FFmpeg Streaming Multimedia System.
说:使用这个选项你需要安装FFmpeg Streaming Multimedia System。

(renamed from ffmpeg_timelaps to ffmpeg_timelapse in 3.1.14)
说:在3.1.14的motion版本中,ffmpeg_timelaps 重新命名为ffmpeg_timelapse 。

ffmpeg_timelapse_mode(时间推移方式)

  • Type: Discrete Strings
  • Range / Valid values: hourly, daily, weekly-sunday, weekly-monday, monthly, manual
  • Default: daily
  • Option Topic

把下面这几段读完感觉有点意思了,这个功能定义一个值后,可以按照这个值所代表的时间来对下一次的文件进行重新名字,以便查看视频的人可以很方便找到想要的某个时间的视频。ffmpeg_timelapse这个选项也是这种用途,只是定义方式不一样,但是ffmpeg_timelapse只用于mepg1视频压缩方式(这是一种旧的压缩方式)。

举个例子更容易理解:假如把此项定义为hourly,那么每隔一个小时你可以对要保存的视频文件定义一个新名字,以便与和之前的文件进行区分。目的是为了让观看视频者尽快的找到想要的视频文件。这样一说好像就明白多了。

其他几个定义请自己再往读一下吧。

The file rollover mode of the timelapse video.

Note that it is important that you use the conversion specifiers in ffmpeg_filename that ensure that the new timelapse file indeed is a new file. If the filename does not change Motion will simply append the timelapse pictures to the existing file.

The value 'Manual' means that Motion does not automatically rollover to a new filename. You can do it manually using the http control interface by setting the option 'ffmpeg_timelapse' to 0 and then back to your chosen value. Value 'hourly' rolls over on the full hour. Value 'daily' which is the default rolls over at midnight. There are two weekly options because depending on where you come from a week may either start on Sunday or Monday. And 'monthly' naturally rolls over on the 1st of the month.

ffmpeg_video_codec(视频压缩方式)

  • Type: Discrete Strings
  • Range / Valid values: mpeg1 (ffmpeg-0.4.8 only), mpeg4, msmpeg4, swf, flv, ffv1, mov
  • Default: mpeg4
  • Option Topic

Codec to be used by ffmpeg for the video compression. Timelapse mpegs are always made in mpeg1 format independent from this option.

  • mpeg1 - gives you mpeg1 files with extension .mpg. It is only supported by the old ffmpeg version 0.4.8. The ffmpeg team decided no longer to support non-standard framerates for mpeg1 from ffmpeg version 0.4.9pre1.
  • mpeg1是一种旧的压缩方式,后缀为.mpg
  • mpeg4 - gives you mpeg4 files with extension .avi
  • mpeg4后缀为.avi,这个很常见
  • msmpeg4 - also gives you mpeg4 files. It is s recommended for use with Windows Media Player because it requires with no installation of codec on the Windows client.
  • swf - gives you a flash film with extension .swf
  • swf格式的视频我也见过
  • flv - gives you a flash video with extension .flv
  • flv格式也很常见
  • ffv1 - FF video codec 1 for Lossless Encoding (experimental)
  • mov - QuickTime (since 3.2.10).

This option does not affect the timelapse feature. Timelapse is always recorded in mpeg1 format because we need to be able to append to an existing file. mpeg4 does not easily allow this.
还是在说timelapse 只用于mpeg1 。
See also the section Advanced Filenames where the two additional options ffmpeg_filename andtimelapse_filename are defined.
说:在 Advanced Filenames 部分还有两个关于ffmpeg的定义,建议你去看一下。
If you want to use this feature you can read about theFFmpeg Streaming Multimedia System
说:如果你想使用这个特性,你可以阅读一下关于FFmpeg Streaming Multimedia System的内容,会对你有帮助。


Snapshots - The Traditional Periodic Web Camera(传统的周期性的网络摄像头)

Motion can also act like a traditional web camera.

snapshot_interval(快照间隔)

  • Type: Integer
  • Range / Valid values: 0 - 2147483647
  • Default: 0 (disabled)
  • Option Topic

Make automated snapshots every 'snapshot_interval' seconds.
说:自动拍照每隔一个snapshot_interval值(以秒为单位)

The snapshots are stored in the target directory + the directory/filename specified by the snapshot_filename option.
说:快照存储在一个由选项snapshot_filename指定的目录中。

This is the traditional web camera feature where a picture is taken at a regular interval independently of motion in the picture.

还是说此特性的功能类似传统的网络摄像头。

See the also snapshot_filename option in the section Advanced Filenames.
说:顺便去看一下在Advanced Filenames部分中的选项snapshot_filename

Text Features(视频中文字的显示特性)

Text features are highly flexible. You can taylor the text displayed on the images and films to your taste and you can add your own user defined text.
说:视频中的文字显示部分很灵活,你可以根据自己的喜好进行配置。

This is how the overlayed text is located.
下面这张图就是在视频上面的文字显示样式,文字以什么样的方式显示由你做主哦亲~

You are allowed to put the text in quotation marks. This allows you to use leading spaces. By combining spaces and new lines '\n' you can place your text anywhere on the picture. Experiment to find your preferred look. When setting the text using http remote control the text must be URL encoded. The browser does this for you. If you need to set it with a command line tool, use a browser first and let it make the encoded URL for you. Then you can copy paste it to your script file or cron line or whatever you want to use.
还是告诉你可以自己尝试着找到最好的文本位置,或者用浏览器来帮助你。浏览器帮我?对,不要忘记motion的所有选项都可以在浏览器中进行设置,真是个强大的功能。

Below are the options that controls the display of text. The 'locate' option is not a text feature but described here because it is related to information overlayed on the output images.
说:下面就开始为你解开这些控制文本选项的真面目。选项locate之所以放到这里来描述,是因为它与输出视频上的覆盖信息有关。

The text_event feature is special in that it defines the conversion specifier %C which can be used both for text display and for filenames.

说:text_event 特性有点特殊,因为它定义的转换说明符C%可以同时用在文本显示和文件名称中。


locate(位置)

  • Type: Boolean
  • Range / Valid values: on, off, preview
  • Default: off
  • Option Topic

Locate and draw a box around the moving object. Value 'preview' makes Motion only draw a box on a saved preview jpeg image and not on the saved mpeg movie.

说:Locate会在移动的物体上画一个框。值preview是Motion在保存的预览图中画一个框,而不是在保存的mpeg影片上画框。

The value 'preview' only works when 'output_normal' is set to either 'first' or 'best'.

 preview仅在output_normal被设置为'first' or 'best'时才有效。


text_changes

  • Type: Boolean
  • Range / Valid values: on, off
  • Default: off
  • Option Topic

Turns the text showing changed pixels on/off.

说:控制文本显示像素值

By setting this option to 'on' the number of pixels that changed compared to the reference frame is displayed in the upper right corner of the pictures. This is good for calibration and test. Maybe not so interesting for a greater public. Set it to your personal taste.

说:这个选项适用于校准和调试。不太适合给大众观看(非专业人士可能看不懂!)。所以,决定权依然在你,看自己的口味行事吧亲


text_double(文本字体大小加倍,目的很清楚)

  • Type: Boolean
  • Range / Valid values: on, off
  • Default: off

Draw characters at twice normal size on images.

说:使图像上的字是正常字体大小的2倍。

This option makes the text defined by text_left, text_right and text_changes twice the normal size. This may be useful when using large picture formats such as 640 x 480.

说:这个选项比较适合尺寸比较大的图像,比如640 x 480.


text_event(事件的时间)

  • Type: String
  • Range / Valid values: Max 4095 characters
  • Default: %Y%m%d%H%M%S
  • Option Topic

This option defines the value of the speciel event conversion specifier %C. You can use any conversion specifier in this option except %C. Date and time values are from the timestamp of the first image in the current event.

The idea is that %C can be used filenames and text_left/right for creating a unique identifier for each event.

Option text_event defines the value %C which then can be used in filenames and text_right/text_left. The text_event/%C uses the time stamp for the first image detected in a new event. %C is an empty string when no event is in progress (gap period expired). Pre_captured and minimum_motion_frames images are time stamped before the event happens so %C in text_left/right does not have any effect on those images.


text_left(左下角的文本)

  • Type: String
  • Range / Valid values: Max 4095 characters
  • Default: Not defined
  • Option Topic

User defined text overlayed on each in the lower left corner. Use A-Z, a-z, 0-9, " / ( ) @ ~ # < > , . : - + _ \n and vertical bar and conversion specifiers (codes starting by a %).

说:位置在左下角。可以使用 A-Z, a-z, 0-9, " / ( ) @ ~ # < > , . : - + _ \n and vertical bar和conversion specifiers 。

text_left is displayed in the lower left corner of the pictures. If the option is not defined no text is displayed at this position.

说:如果诶有定义此选项,则不显示关于该选项的任何内容

You can place the text in quotation marks to allow leading spaces. With a combination is spaces and newlines you can position the text anywhere on the picture.

说:把文本放在引号内可以允许空格开头。通过空格和\n的组合允许文本显示在图像上的任何位置。闭上眼想像一下就可以明白了。

Detailed Description

A conversion specifier is a code that starts by % (except newline which is \n). The conversion specifiers used has the same function as for the C function strftime (3). The most commonly used are:

详细说明转换说明符的含义。

  • %Y = year
  • %m = month as two digits
  • %d = date
  • %H = hour
  • %M = minute
  • %S = second
  • %T = HH:MM:SS

These are unique to motion
  • %v = event
  • %q = frame number
  • %t = thread (camera) number
  • %D = changed pixels
  • %N = noise level
  • %i = width of motion area
  • %J = height of motion area
  • %K = X coordinate of motion center
  • %L = Y coordinate of motion center
  • %C = value defined by text_event

With a combination of text, spaces, new lines \n and conversion specifiers you have some very flexible text features.

For a full list of conversion specifiers see the section Conversion Specifiers for Advanced Filename and Text Feature.

说:相信内容参见Advanced Filename 和Text Feature的.Conversion Specifiers 部分。


text_right(右下角的文本)

  • Type: String
  • Range / Valid values: Max 4095 characters
  • Default: %Y-%m-%d\n%T
  • Option Topic
text_left类似,不同点是,text_right 有默认值,默认值为%Y-%m-%d\n%T,会以  ISO格式显示日期YYYY-MM-DD,并在日期的下面以24小时制的方式显示时间HH:MM:SS。
User defined text overlayed on each in the lower right corner. Use A-Z, a-z, 0-9, " / ( ) @ ~ # < > , . : - + _ \n and vertical bar and conversion specifiers (codes starting by a %). Default: %Y-%m-%d\n%T = date in ISO format and time in 24 hour clock

text_right is displayed in the lower right corner of the pictures. If the option is not defined no text is displayed at this position.

You can place the text in quotation marks to allow leading spaces. With a combination is spaces and newlines you can position the text anywhere on the picture.

A major difference from text_left is that if this option is undefined the default is %Y-%m-%d\n%T which displays the date in ISO format YYYY-MM-DD and below the time in 24 hour clock HH:MM:SS.

Detailed Description

A conversion specifier is a code that starts by % (except newline which is \n). The conversion specifiers used has the same function as for the C function strftime (3). The most commonly used are:
  • %Y = year
  • %m = month as two digits
  • %d = date
  • %H = hour
  • %M = minute
  • %S = second
  • %T = HH:MM:SS

These are unique to motion
  • %v = event
  • %q = frame number
  • %t = thread (camera) number
  • %D = changed pixels
  • %N = noise level
  • %i = width of motion area
  • %J = height of motion area
  • %K = X coordinate of motion center
  • %L = Y coordinate of motion center
  • %C = value defined by text_event

With a combination of text, spaces, new lines \n and conversion specifiers you have some very flexible text features.

For a full list of conversion specifiers see the sectionConversion Specifiers for Advanced Filename and Text Feature.

说:把文本放在引号内可以允许空格开头。通过空格和\n的组合允许文本显示在图像上的任何位置。详细内容参见Advanced Filename 和Text Feature的.Conversion Specifiers 部分。


(回去睡觉,过个周末)

(周末结束,继续  . . .)

Advanced Filenames(厉害的文件命名方法)

Motion has a very advanced and flexible automated filenaming feature.

说:Motion有高级且灵活的文件自动命名规则。

By using conversion specifiers (codes that consist of a '%' followed by a letter) you can build up the filenames including sub directories for pictures and movies using any combination of letters, numbers and conversion specifiers which are codes that represents time, date, event number and frame numbers.

说:通过使用转换说明符你可以得到任何你想要的文件名称,当然前提是文件的名称是由时间、事件号等组成的。

The option target_dir is the target directory for all snapshots, motion images and normal images. The default is the current working directory (current working directory of the terminal from which motion was started). You will normally always want to specify this parameter.

说:Motion的输出结果全部都保存在target_dir 这个选项所定义的目录中。target_dir 默认是运行motion的当前目录。通常你需要根据自己的情况指明target_dir 这个参数。

Note that the options snapshot_filename,jpeg_filenameffmpeg_filename, andtimelapse_filename all allow specifying directories by using '/' in the filename. These will all be relative to target_dir. This means in principle that you can specify target_dir as '/' and be 100% flexible. It also means that Motion can write files all over your harddisk if you make a mistake. It is recommended to specify the target_dir as deep or detailed as possible for this reason. And note that targer_dirdoes not allow conversion specifiers.

说:选项snapshot_filename,jpeg_filenameffmpeg_filenametimelapse_filename允许指明的目录名称中包含字符'/'。它们的目录全都和target_dir相关联。需要注意的是,如果你指定target_dir时有错误,那么将会出现motion在你的硬盘上到处都存有文件。所以,建议你一定要严格详细地指定target_dir所代表的目录。而且,target_dir不允许包含转换说明符。(说明白了,这段话就是要告诉你,target_dir这个目录非常重要,一定要使用绝对路径,因为其他文件的输出目录都跟它有关。

The conversion specifier %C which is defined by the option text_event is interesting in connection with filenames because it can be used to create files and directories for each event in a very flexible way.

The convertion specifier %t (thread/camera number) is also very useful. Here is an example of filename definitions in motion.conf:

说:%t很有用,它可以代表线程或者相机的序号,看看下面的例子就明白了。下面是一个在motion.conf中定义文件名称的例子,可以参考一下:

target_dir /usr/local/webcam
snapshot_filename cam%t/%v-%Y%m%d%H%M%S-snapshot
jpeg_filename cam%t/%v-%Y%m%d%H%M%S-%q
ffmpeg_filename cam%t/%v-%Y%m%d%H%M%S
timelapse_filename cam%t/%Y%m%d%H-timelapse

The smart thing is that this defines the filename of all your camera threads in motion.conf so you do not need to specify target dir and filenames in the thread config files. In the above example an mpegfile for camera thread 3 will be saved as a filename similar to/usr/local/webcam/cam3/28-20051128130840.avi(分析一下名称的组合可以帮助理解)

NOTE: Unless you use the minimum_gap option to limit the number of shots to less then one per second - you must use the frame modifier %q as part of the jpeg_filename. Otherwise the pictures saved within the same second will overwrite each other. The %q injpeg_filename ensures that each jpeg (or ppm) picture saved gets a unique filename.

说:除非你使用了minimum_gap 选项,否则在定义jpeg_filename时一定要使用%q 这个说明符。%q 可以保证jpeg_filename文件不重名。重名就会覆盖之前的文件。

ALERT! Security Warning! Note that the flexibility of this feature also means you have to pay attention to the following.

主要告诉你一些安全警告,建议你使用一个普通无害的用户运行motion,不要使用root。

  • Anyone with access to the remote control port (http) can alter the values of these options and save files anywhere on your server with the same privileges as the user running Motion. Anyone can access your control port if you have not either limited access to localhost or limited access using firewalls in the server. You should always have a router between a machine running Motion with remote control enabled and the Internet and make sure the Motion control port is not accessible from the outside.
  • Anyone with local access to the computer and edit rights to the motion.conf file can alter the values of these options and save files anywhere on your server with the same privileges as the user running Motion. Make sure the motion.conf file is maximum readonly to anyone else but the user running Motion.
  • It is a good idea to run Motion as a harmless user. Not as root.

These are the advanced filename options in motion.conf

下面是在motion.conf中关于文件名称的选项


target_dir(目标目录,最重要的一个)

  • Type: String
  • Range / Valid values: Max 4095 characters
  • Default: Not defined = current working directory(默认为当前工作目录)
  • Option Topic

ffmpeg_filename (now called movie_filename)(在版本3.2.5中已经重命名为movie_filename

ALERT! This option was renamed to movie_filename in 3.2.5 to enable better integration of alternative movie libraries to the current ffmpeg solution.

  • Type: String
  • Range / Valid values: Max 4095 characters
  • Default: %v-%Y%m%d%H%M%S
  • Option Topic

下面主要告诉你命名方式和要注意的地方,上面已经介绍过。在这里我建议把target_dir 定义为自己希望的绝对路径后,其他的几个选项用默认值就行,除非有很强的目的性再去改它们。下面的几个选项也是类似的。

File path for motion triggered ffmpeg movies (mpeg) relative to target_dir. This option was renamed to movie_filename in 3.2.5 to enable better integration of alternative movie libraries to the current ffmpeg solution.

Default value is equivalent to legacy 'oldlayout' option For Motion 3.0 compatible mode (directories based on date and time) choose: %Y/%m/%d/%H%M%S

File extension .mpg or .avi is automatically added so do not include this.

This option uses conversion specifiers which are codes that start by % and then a letter. The conversion specifiers used has the same function as for the C function strftime (3). The most commonly used are:

  • %Y = year
  • %m = month as two digits
  • %d = date
  • %H = hour
  • %M = minute
  • %S = second
  • %T = HH:MM:SS

These are unique to motion
  • %v = event
  • %q = frame number
  • %t = thread (camera) number
  • %D = changed pixels
  • %N = noise level
  • %i = width of motion area
  • %J = height of motion area
  • %K = X coordinate of motion center
  • %L = Y coordinate of motion center
  • %C = value defined by text_event

If you are happy with the directory structures the way they were in earlier versions of motion use %v-%Y%m%d%H%M%S for 'oldlayout on' and %Y/%m/%d/%H%M%S for 'oldlayout off'.

jpeg_filename

  • Type: String
  • Range / Valid values: Max 4095 characters
  • Default: %v-%Y%m%d%H%M%S-%q
  • Option Topic

movie_filename(之前叫ffmpeg_filename

  • Type: String
  • Range / Valid values: Max 4095 characters
  • Default: %v-%Y%m%d%H%M%S
  • Option Topic

snapshot_filename

  • Type: String
  • Range / Valid values: Max 4095 characters
  • Default: %v-%Y%m%d%H%M%S-snapshot
  • Option Topic
timelapse_filename
  • Type: String
  • Range / Valid values: Max 4095 characters
  • Default: %v-%Y%m%d-timelapse
  • Option Topic


Conversion Specifiers for Advanced Filename and Text Features(转换说明符)

The table below shows all the supported Conversion Specifiers you can use in the options text_event,text_lefttext_rightsql_query,snapshot_filenamejpeg_filename,ffmpeg_filenametimelapse_filename,on_event_starton_event_endon_picture_save,on_movie_starton_movie_end, andon_motion_detected.

说:下表中的转换说明符可以用在 text_event,text_lefttext_rightsql_query,snapshot_filename

jpeg_filename,ffmpeg_filenametimelapse_filename,on_event_starton_event_endon_picture_save,on_movie_starton_movie_end, andon_motion_detected这些选项中。

In text_left and text_right you can additionally use '\n' for new line.

说:在选项text_left and text_right中还可以加上'\n' 来换行。

转换说明符列表链接 点击打开链接


Webcam Server(网络相机服务,就是支持在网页上观看视频)

Motion has simple webcam server built in. The video stream is in mjpeg format.

说:Motion内置有简单的网络相机服务。视频格式为mjpeg。

Each thread can have its own webcam server. If you enable the webcam server (option webcam_port to a number different from 0) and you have more than one camera, you must make sure to include webcam_port in each thread config file and set webcam_port to different and unique port numbers or zero (disable). Otherwise each webcam server will use the setting from the motion.conf file and try to bind to the same port. If the webcam_port numbers are not different from each other Motion will disable the webcam feature.

说:每一个线程都可以有自己的网路相机。如果你使能了网络相机(即选项webcam_port非0)并且有多个相机,那么你必须确保每个相机的线程有自己独立的 webcam_port 值(非0)。否则每个网络相机都将使用motion.conf 中设定的webcam_port, 都试图去连接那同一个webcam_port 从而产生冲突。如果每个网络相机的webcam_port 值是唯一的,那么Motion将忽略motion中的webcam特性。

Note: The webcam server feature requires that the option ppm is set to off.

注意:网络相机需要把ppm这个选项关掉。

The webcam_maxrate and webcam_quality options are important to limit the load on your server and link. Don't set them too high unless you only use it on the localhost or on an internal LAN. The option webcam_quality is equivalent to the quality level for jpeg pictures.

说:不要把选项webcam_maxrate and webcam_quality很重要,但是不要把它们设置的太大,除非你只在本地或者网络LAN上使用。webcam_quality 选项等价于jpeg图片的质量。

The webcam_limit option prevents people from loading your Network connection by streaming for hours and hours. The options defines the number of picture frames sent as mjpeg Motion will allow without re-connecting (e.g. clicking refresh in the browser).

说:webcam_limit 选项阻止别人不停地加载你的网络连接。它定义了作为mjpeg格式发送的图片数量。Motion不用重新连接。

The option webcam_localhost is a security feature. When enabled you can only access the webserver on the same machine as Motion is running on. If you want to present a live webcam on your web site this feature must be disabled.

说:webcam_localhost 选项是一个安全特性,它只允许在本机上使用网络服务。如果你想在网址上线展示,那就把这个选项关掉。

The webserver generates a stream in "multipart jpeg" format (mjpeg). You cannot watch the stream with most browsers. Only certain versions of Netscape works. Mozilla and Firefox brosers can view the mjpeg stream but you often have to refresh the page once to get the streaming going. Internet Explorer cannot show the mjpeg stream. For public viewing this is not very useful. There exists a java applet called Cambozola which enabled any Java capable browser to show the stream. To enable the feature to a broad audience you should use this applet or similar.

主要告诉你如果想在浏览器上看motion工作时的视频,你只能使用Mozilla and Firefox这种支持流mjpeg 的浏览器。Internet Explorer不行。但是你可以通过支持java的浏览器使用一个叫 Cambozola的java小程序来观看motion的视频。
To use the webcam feature with Cambozola is actually very simple.

说:用Cambozola 很简单,下面就是步骤。

1. Create a html page in which you will want the streamed picture.

打开浏览器

2. In the html page include this code

在地址栏输入下面的代码

 <applet code=com.charliemouse.cambozola.Viewer
    archive=cambozola.jar width="320" height="240" style="border-width:1; border-color:gray; border-style:solid;"> <param name=url value="http://www.myurl.com:8081"> </applet> 

Where the width and height is the image size of the video stream.

width and height是图像的尺寸

Replace www.myurl.com:8081 by the real url and port number of your choice.

用你真实的链接和端口替换www.myurl.com:8081

3. In the same directory you place the cambozola.jar file. No need to build the java applet from source. Simply use the applet in the package.

在同一个目录中加入文件cambozola.jar,不用编译,只是使用。

4. Enable the feature in motion.conf.

最后在motion.conf使能网络相机的特性即可


You can also view the live webcam stream using MPlayer like this:

你还可以通过MPlayer来观看在线的饿视频,方式如下

mplayer -demuxer lavf http://www.myurl.com:8081/stream.mjpg

Note that the stream.mjpg part is important, without it you will get a LAVF_check: no clue about this gibberish! error from libavformat.

注意stream.mjpg 一定要加上,否则会有错误

Note that you can stream from multiple videos by having several applet viewers on each page (pointed to different url's, of course).

你可以通过多个浏览器页面同时观看多个相机的视频,每个相机指向不同的端口。

These are the special webcam parameters.

下面就是这些特殊的网络相机参数,上面已经介绍的饿差不多了,简单看一下它们的定义就行。


webcam_limit

  • Type: Integer
  • Range / Valid values: 0 - 2147483647
  • Default: 0 (unlimited)
  • Option Topic

webcam_localhost

  • Type: Boolean
  • Range / Valid values: on, off
  • Default: on
  • Option Topic

webcam_maxrate

  • Type: Integer
  • Range / Valid values: 1 - 100
  • Default: 1
  • Option Topic

webcam_motion

  • Type: Boolean
  • Range / Valid values: on, off
  • Default: off
  • Option Topic

webcam_port

  • Type: Integer
  • Range / Valid values: 0 - 65535
  • Default: 0 (disabled)
  • Option Topic

webcam_quality

  • Type: Integer
  • Range / Valid values: 1 - 100
  • Default: 50
  • Option Topic


Remote Control with http(利用HTTP进行远程控制)

Motion can be remote controlled via a simple http interface. http is the language a normal web browser talks when it requests a web page. The web server answers back with some simple http headers followed by a webpage coded in HTML.

说:motion可以通过简单的HTTP见面来控制。

Most Motion config options can be changed while Motion is running except options related to the size of the captured images and mask files which are loaded only when Motion starts. So only your fantasy sets the limit to what you can change combining cron and the remote control interface for Motion.

说:大部分的配置选项都可以远程控制,除了那些和图像尺寸相关的和那一些在一开始就加载到motion中的mask文件。

So the most obvious tool to use to remote control Motion is any web browser. All commands are sent using the http GET method which simply means that the information is sent via the URL and maybe a query string. You can use any browser (Firefox, Mozilla, Internet Explorer, Konquerer, Opera etc). You can also use the text based browser lynx to control Motion from a console. It navigates fine through the very simple and minimalistic http control interface of Motion.

说:你可以用任何浏览器来进行远程控制。

The details about how to control Motion via the URL is described in detail in the Motion http API topic.

说:详细的远程控制信息请阅读Motion http API 。

But it is probably simpler to connect to the control port with a browser, navigate to the function you want, and copy the URL from the browser URL entry line. If your control_port is 8080 and you browse from the same machine on which Motion runs simply look up http://localhost:8080/ and navigate around. Connecting from a remote machine is done by using a domain name (examplehttp://mydomain.com:8080/) or the IP address of the machine (example http://192.168.1.4:8080/). The option control_localhost must be off to allow connection from a remote machine.

说:用浏览器连接motion很简单。如果 control_port 是8080,那么在本机上可以在浏览器地址栏中直接输入http://localhost:8080/ ,如果远程控制则输入http://mydomain.com:8080/,mydomain为你的域名,用IP待地也行。如果要使用这个选项,你要control_localhost这个选项关掉。

If you want to use a script or cron to automatically change Motion settings while Motion runs you use a program that can fetch a webpage. We simply just throw away the html page that Motion returns. Programs commonly available on Linux machines are wget and lwp-request. Here is an example of how to start and stop motion detection via cron. These two lines are added to /etc/crontab.
说:如果你想使用一个脚本或者cron来自动改变Motion的设定。下面是一个用cron的例子,把下面两行代码加到/etc/crontab文件中。

0 9 * * * root /usr/bin/lwp-request http://localhost:8080/0/detection/start > /dev/null
0 18 * * * root /usr/bin/lwp-request http://localhost:8080/0/detection/pause > /dev/null

If you want to use the http remote control from your own software (for example your own PHP front end) you can set the new motion.conf option html_output off. Then Motion answers back with very basic text only and no html around it. A bit like the xmlrpc interface did.
说:如果你想用自己软件远程控制,你可以把html_output 选项关掉。

To remote control Motion from a web pages you can for example use PHP. In PHP it takes this simple code line to send a remote commend to Motion. Here we pause motion detection for camera 2

readfile('http://localhost:8080/2/detection/pause');

What happened to XMLRPC?

XMLRPC is replaced by a simpler http remote control interface. It is still being worked on but it is absolutely useable now and much nicer to work with than xmlrpc. Another advantage is that you do not need to install xmlrpc libraries. It is all written in standard C.

ALERT! Security Warning! Note that this feature also means you have to pay attention to the following.
告诉你使用此选项的要注意的事项:不要用root运行,要用一个安全的用户。
  • Anyone with access to the remote control port (http) can alter the values of any options and save files anywhere on your server with the same privileges as the user running Motion. They can execute any command on your computer with the same privileges as the user running Motion. Anyone can access your control port if you have not either limited access to localhost or limited access using firewalls in the server. You should always have a router between a machine running Motion with remote control enabled and the Internet and make sure the Motion control port is not accessible from the outside.
  • If you limit control port to localhost you still need to take care of any user logging into the server with any kind of terminal session.
  • It is a good idea to run Motion as a harmless user. Not as root!!

These are the config file options that control Motion.
下面是控制Motion的一些选项

These must be placed in motion.conf and not in a thread config file.
要把他们放在motion.conf 中,而不是放在线程的配置文件中。

control_authentication(控制的认证,可以设置用户名和密码登录的方式)

  • Type: String
  • Range / Valid values: Max 4096 characters
  • Default: Not defined
  • Option Topic

control_html_output

  • Type: Boolean
  • Range / Valid values: on, off
  • Default: on
  • Option Topic

control_localhost(本地控制)

  • Type: Boolean
  • Range / Valid values: on, off
  • Default: on
  • Option Topic

control_port(控制端口)

  • Type: Integer
  • Range / Valid values: 0 - 65535
  • Default: 0 (disabled)
  • Option Topic



External Commands(外部命令的执行)

Motion can execute external commands based on the motion detection and related events. They are all described in this section. The option quiet is also included in this section.
说:Motion可以基于运动检测和相关的时间执行外部命令(比如可以执行shell脚本程序)。选项quiet也在这部分。
A redesign of the external commands was due. They were not very easy to understand, not all were flexible enough and some were missing. So a new external command feature set was made for 3.2.1 and on.
说:有些外部命令被重新设计了,有的是新定义的。
新的脚本命令及变化 点击打开链接
ALERT! Security Warning! Note that this feature also means you have to pay attention to the following.
告诉你使用此选项的要注意的事项:不要用root运行,要用一个安全的用户。
  • Anyone with access to the remote control port (http) can execute any command on your computer with the same privileges as the user running Motion. Anyone can access your control port if you have not either limited access to localhost or limited access using firewalls in the server. You should always have a router between a machine running Motion with remote control enabled and the Internet and make sure the Motion control port is not accessible from the outside.
  • If you limit control port to localhost you still need to take care of any user logging into the server with any kind of GUI or terminal session. All it takes is a browser or single command line execution to change settings in Motion.
  • It is a good idea to run Motion as a harmless user. Not as root!!

These are the options
下面是具体的选项

on_area_detected

  • Type: String
  • Range / Valid values: Max 4095 characters
  • Default: Not defined
  • Option Topic

Command to be executed when motion in a predefined area is detected. Check option area_detect.
说:当预指定的区域被检测到有变化时执行此选项所指定的脚本。需要检查area_detect选项是否被设置。

on_camera_lost(当打不开或找不到相机时执行脚本)

  • Type: String
  • Range / Valid values: Max 4095 characters
  • Default: Not defined
  • Option Topic
Command to be executed when a camera can't be opened or if it is lost. You can use Conversion Specifiers and spaces as part of the command. Use %f for passing filename (with full path) to the command. (new in 3.2.10)
NOTE: There is situations when motion don't detect a lost camera!
注意:存在找不到的相机的情况,这取决于驱动。
It depends on the driver, some drivers dosn't detect a lost camera at all
Some hangs the motion thread. Some even hangs the PC!

on_event_end(事件结束时执行)

  • Type: String
  • Range / Valid values: Max 4095 characters
  • Default: Not defined
  • Option Topic
Command to be executed when an event ends after a period of no motion. The period of no motion is defined by option gap. You can use Conversion Specifiers and spaces as part of the command.
说:当gap时间没有检测到运动时执行脚本命令。

Full path name of the program/script.
要使用绝对路径。

This can be any type of program or script. Remember to set the execution bit in the ACL and if it is a script type program such as perl or bash also remember the shebang line (e.g. #!/user/bin/perl) as the first line of the script.
说:命令的类型可以是程序或者脚本。记住要设置命令为可执行的。如果是脚本不要忘了加上解析命令行(如#!/user/bin/perl))。

The command is run when an event is over. I.e. the number of seconds defined by the time 'gap' has passed since the last detection of motion and motion closes the mpeg file.
这个命令与gap有关,因为是在on_event_start执行后,gap时间间隔内没有检测到运动才会执行这个选项对应的命令。

on_event_start(事件开始执行)

  • Type: String
  • Range / Valid values: Max 4095 characters
  • Default: Not defined
  • Option Topic
这个命令在时间开始时被执行。在此选项对应的命令执行后,gap时间间隔内没有检测到运动才会执行on_enent_end这个选项对应的命令。其他与on_enent_end类似。

on_motion_detected

  • Type: String
  • Range / Valid values: Max 4095 characters
  • Default: Not defined
  • Option Topic

Command to be executed when a motion frame is detected. You can use Conversion Specifiers and spaces as part of the command.
说:当检测到一个运动帧时执行此选项对应的命令。
Do not write "none" if you do not want to execute commands. Simply do not include the option in the file or comment it out by placing a "#" or ";" as the first character on the line before the execute command.
说:如果你不使用此选项,那么用"#" or ";"放到此选项开头位置,把它注释掉,不要使用none对其赋值。

on_movie_end

  • Type: String
  • Range / Valid values: Max 4095 characters
  • Default: Not defined
  • Option Topic 

Command to be executed when an ffmpeg movie is closed at the end of an event. You can useConversion Specifiers and spaces as part of the command. Use %f for passing filename (with full path) to the command.

说:在一个事件结束时当一个ffmpeg影片被关闭时执行其命令。

Full path name of the program/script.
使用绝对路径。

This can be any type of program or script. Remember to set the execution bit in the ACL and if it is a script type program such as perl or bash also remember the shebang line (e.g. #!/user/bin/perl) as the first line of the script.

The command is run when an event is over. I.e. the number of seconds defined by the time 'gap' has passed since the last detection of motion and motion closes the mpeg file.

This option was previously called onffmpegclose.
这个选项以前叫onffmpegclose。

on_movie_start

  • Type: String
  • Range / Valid values: Max 4095 characters
  • Default: Not defined
  • Option Topic
Command to be executed when an mpeg movie is created. You can use Conversion Specifiers and spaces as part of the command. Use %f for passing filename (with full path) to the command.
说:当创建一个mpeg影片时执行此命令。

Full path name of the program/script.
使用绝对路径。

This can be any type of program or script. Remember to set the execution bit in the ACL and if it is a script type program such as perl or bash also remember the shebang line (e.g. #!/user/bin/perl) as the first line of the script. When you use ffmpeg the film is generated on the fly and on_movie_start then runs when the new mpeg file is created. Often you will want to use the on_movie_end option which runs when the mpeg file is closed and the event is over.
告诉你,它和on_movie_end成对使用
This option was previously called onmpeg.
这个选项之前叫onmpeg。

on_picture_save

  • Type: String
  • Range / Valid values: Max 4095 characters
  • Default: Not defined
  • Option Topic
Command to be executed when an image is saved. You can use Conversion Specifiers and spaces as part of the command. Use %f for passing filename (with full path) to the command。
说:当一个图像被保存时执行此命令。
Full path name of the program/script.
使用绝对路径。
This can be any type of program or script. Remember to set the execution bit in the file access control list (chmod) and if it is a script type program such as perl or bash also remember the shebang line (e.g. #!/usr/bin/perl) as the first line of the script.

quiet

  • Type: Boolean
  • Range / Valid values: on, off
  • Default: off
  • Option Topic

Be quiet, don't output beeps when detecting motion.
说:当探测到运动时不发出声音。
Only works in non-daemon mode.
说:仅仅在非daemon模式下有效。

What happened to mail and sms?

The 6 new on_xxxxx options replace the former execute, mail and sms options.
说:这六个新的on_xxxxx选项代替了之前的execute, mail and sms选项。

They are quite generic and flexible. These small bash scripts gives to the same functionality as mail and sms BUT you have all the flexibility you want to extend the messages, change the 'from' email address etc.
说:它们通用并且灵活。

Sending email at start of event(在事件开始发送邮件)

_Script written by JoergWeber _(此脚本归功于JoergWeber 
#!/bin/sh

# Motion sample script to send an e-mail at start of an event.
# Replaces the former 'mail' option.
# Just define this script as 'on_event_start'-script in motion.conf like that:
# on_event_start send_mail "%Y-%m-%d %T"  (这是定义的样式,很重要)

#change to suit your needs:
#location of 'mail' binary(mail命令的二进制文件路径)
MAIL="/usr/bin/mail"
#Destination e-mail address(e-mail地址,即发给谁)
TO="root@localhost"
#Subject of the e-mail(e-mail的主题)
SUBJECT="Motion detected"

#Don't change anything below this line(不要修改此行的任何内容)
echo -e "This is an automated message generated by motion.\n\nMotion detected: $1\n\n" | $MAIL -s "$SUBJECT" $TO


Sending SMS at start of event(在时间开始时发送SMS)

_Script written by JoergWeber _(此脚本归功于JoergWeber 

If you uncomment the line #/usr/local/bin/send_mail $1 you can combine both sending email and sms.
如果你不把  #/usr/local/bin/send_mail $1   这行内容注释掉,你可以同时发送email和sms。
#!/bin/sh

# Motion sample script to send an sms at start of an event.
# Replaces the former 'sms' option.
# Just define this script as 'on_event_start'-script in motion.conf like that:
# on_event_start send_sms "%Y-%m-%d %T"(这是定义的样式,很重要)
#
# If you want to send an e-mail message here as well, just uncomment the last
# line of this script.

#change to suit your needs:
#location of 'sms-client' binary(二进制文件sms-client的位置
SMS_CLIENT="/usr/bin/sms_client"
#Destination sms number(sms号码,即发给谁)
TO="12345"

#Don't change anything below this line(下行内容不要改)
$SMS_CLIENT $TO "Motion detected $1"

#/usr/local/bin/send_mail $1(如果相同时发送邮件,那么去掉注释即可)

-- KennethLavrsen - 13 Apr 2005




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Effective Robotics Programming with ROS, Third Edition gives you a comprehensive review of ROS, the Robot Operating System framework, which is used nowadays by hundreds of research groups and companies in the robotics industry. More importantly, ROS is also the painless entry point to robotics for nonprofessionals and students. This book will guide you through the installation process of ROS, and soon enough, you will be playing with the basic tools and understanding the different elements of the framework. The content of the book can be followed without any special devices, and each chapter comes with a series of source code examples and tutorials that you can run on your own computer. This is the only thing you need to follow the book. However, we also show you how to work with hardware so that you can connect your algorithms with the real world. Special care has been taken in choosing devices that are affordable for amateur users, but at the same time, the most typical sensors or actuators in robotics research are covered. Finally, the potential of ROS is illustrated with the ability to work with whole robots in a real or simulated environment. You will learn how to create your own robot and integrate it with a simulation by using the Gazebo simulator. From here, you will have the chance to explore the different aspects of creating a robot, such as perceiving the world using computer vision or point cloud analysis, navigating through the environment using the powerful navigation stack, and even being able to control robotic arms to interact with your surroundings using the MoveIt! package. By the end of the book, it is our hope that you will have a thorough understanding of the endless possibilities that ROS gives you when developing robotic systems.What this book covers Chapter 1, Getting Started with ROS, shows the easiest way you must follow in order to have a working installation of ROS. You will see how to install ROS on different platforms, and you will use ROS Kinetic throughout the rest of the book. This chapter describes how to make an installation from Debian packages, compile the sources, and make installations in virtual machines, Docker, and ARM CPU. Chapter 2, ROS Architecture and Concepts, is concerned with the concepts and tools provided by the ROS framework. We will introduce you to nodes, topics, and services, and you will also learn how to use them. Through a series of examples, we will illustrate how to debug a node and visualize the messages published through a topic. Chapter 3, Visualization and Debugging Tools, goes a step further in order to show you powerful tools to debug your nodes and visualize the information that goes through the node's graph along with the topics. ROS provides a logging API that allows you to diagnose node problems easily. In fact, we will see some powerful graphical tools, such as rqt_console and rqt_graph, as well as visualization interfaces, such as rqt_plot and rviz. Finally, this chapter explains how to record and play back messages using rosbag and rqt_bag. Chapter 4, 3D Modeling and Simulation, constitutes one of the first steps in order to implement your own robot in ROS. It shows you how to model a robot from scratch and run it in simulation using the Gazebo simulator. You will simulate sensors, such as cameras and laser range sensors. This will later allow you to use the whole navigation stack provided by ROS and other tools. Chapter 5, The Navigation Stack – Robot Setups, is the first of two chapters concerned with the ROS navigation stack. This chapter describes how to configure your robot so that it can be used with the navigation stack. In the same way, the stack is explained, along with several examples. Chapter 6, The Navigation Stack – Beyond Setups, continues the discussion of the previous chapter by showing how we can effectively make our robot navigate autonomously. It will use the navigation stack intensively for that. This chapter shows the great potential of ROS using the Gazebo simulator and RViz to create a virtual environment in which we can build a map, localize our robot, and do path planning with obstacle avoidance. Chapter 7, Manipulation with MoveIt!, is a set of tools for mobile manipulation in ROS. This chapter contains the documentation that you need to install this package. The chapter also contains example demonstrations with robotic arms that use MoveIt! for manipulation tasks, such as grasping, picking and placing, or simple motion planning with inverse kinematics. Chapter 8, Using Sensors and Actuators with ROS, literally connects ROS with the real world. This chapter goes through a number of common sensors and actuators that are supported inROS, such as range lasers, servo motors, cameras, RGB-D sensors, and GPS. Moreover, we explain how to use embedded systems with microcontrollers, similar to the widely known Arduino boards. Chapter 9, Computer Vision, shows the support for cameras and computer vision tasks in ROS. This chapter starts with drivers available for FireWire and USB cameras so that you can connect them to your computer and capture images. You will then be able to calibrate your camera using the ROS calibration tools. Later, you will be able to use the image pipeline, which is explained in detail. Then, you will see how to use several APIs for vision and integrate OpenCV. Finally, the installation and usage of a visual odometry software is described. Chapter 10, Point Clouds, shows how to use Point Cloud Library in your ROS nodes. This chapter starts with the basics utilities, such as read or write a PCL snippet and the conversions needed to publish or subscribe to these messages. Then, you will create a pipeline with different nodes to process 3D data, and you will downsample, filter, and search for features using
OpenCV with Python Blueprints By Michael Beyeler 2015 | 230 Pages | ISBN: 1785282697 | Design and develop advanced computer vision projects using OpenCV with Python About This Book Program advanced computer vision applications in Python using different features of the OpenCV library Practical end-to-end project covering an important computer vision problem All projects in the book include a step-by-step guide to create computer vision applications Who This Book Is For This book is for intermediate users of OpenCV who aim to master their skills by developing advanced practical applications. Readers are expected to be familiar with OpenCV's concepts and Python libraries. Basic knowledge of Python programming is expected and assumed. What You Will Learn Generate real-time visual effects using different filters and image manipulation techniques such as dodging and burning Recognize hand gestures in real time and perform hand-shape analysis based on the output of a Microsoft Kinect sensor Learn feature extraction and feature matching for tracking arbitrary objects of interest Reconstruct a 3D real-world scene from 2D camera motion and common camera reprojection techniques Track visually salient objects by searching for and focusing on important regions of an image Detect faces using a cascade classifier and recognize emotional expressions in human faces using multi-layer peceptrons (MLPs) Recognize street signs using a multi-class adaptation of support vector machines (SVMs) Strengthen your OpenCV2 skills and learn how to use new OpenCV3 features
Learning C++ by Building Games with Unreal Engine 4: A beginner’s guide to learning 3D game development with C++ and UE4, 2nd Edition by Sharan Volin--July 1, 2019 English | 2018 | ISBN: 1788476249 | 468 Pages | EPUB | 1117 MB Create your own games using Unreal Engine 4 while learning the fundamentals of C++ programming Learning to program in C++ requires some serious motivation. Unreal Engine 4 (UE4) is a powerful C++ engine with a range of features used to create exciting games by AAA studios, which makes it an engaging way to get started with exploring C++17. This book starts by helping you install a code editor so you can begin to write C++17 code. You will then focus on C++ fundamentals such as variables, memory, conditional statements, and looping. Next, you will cover important programming constructs including functions, objects, classes, and inheritance. As you progress, you’ll delve into more advanced C++17 concepts, along with understanding the functionality of the UE4 engine. In the next few chapters, you will use the UE4 editor to create your own virtual world, and even program some seriously fun gameplay. After this, you’ll learn to build game features, along with using AI aspects such as pathfinding and behavior trees to build smart game entities. The concluding chapters will show you how to improve user interface (UI) feedback with Unreal Motion Graphics (UMG) and audio. In this new and updated edition, you’ll also get to grips with the latest VR and AR features available. By the end of this book, you will have the skills you need to program effectively in C++17. What you will learn Learn the basics of C++ and understand basic UE4 editing Work with the UE4 editor and study the basics of using C++ and Blueprints within the engine Get up to speed with using basic C++ containers and data structures to store your game data Create players, non-player characters (NPCs), and monsters Give game information to users using the UE4 UMG UI system Gain a basic understanding of how to use procedural programming to give your game more replay value Discover how UE4 can help you build projects using the latest technologies, such as VR and AR

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值