mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
translated by ThomazL
This commit is contained in:
parent
805d31ebe1
commit
ed5f53eca4
@ -1,108 +0,0 @@
|
|||||||
>> Translating by ThomazL
|
|
||||||
How to install Raspberry Pi camera board
|
|
||||||
================================================================================
|
|
||||||
[The Raspberry Pi camera (Pi Cam) board][1] was first released for sale in May 2013. This first release is equipped with a 5 Megapixel sensor, and connects through a ribbon cable to the CSI connector on the Raspberry Pi. The second release of Raspberry Pi camera board, which is called [Pi NoIR][2], has the same sensor, but without the IR filter. It has capability to see near IR wavelengths (700 - 1000 nm) like a security camera, and of course it is sacrificing the color rendition.
|
|
||||||
|
|
||||||
In this article, we will show you **how to install a Raspberry Pi camera board on [Raspberry Pi][3]**. We will be using the first release of Pi camera board. Once the board is installed, you will use three applications to access the board: raspistill, raspiyuv, and raspivid. The first two apps are used for capturing images, while the third app is for capturing video. The raspistill tool produces standard image files such as .jpg images, but raspiyuv gives us unprocessed raw image files from the camera.
|
|
||||||
|
|
||||||
### Installing the Raspberry Pi Camera Board ###
|
|
||||||
|
|
||||||
To connect the Raspberry Pi camera board to Raspberry Pi, follow these instructions:
|
|
||||||
|
|
||||||
1. Locate the CSI connector (the CSI connector is located near the Ethernet Port), and take off the brown tape.
|
|
||||||
|
|
||||||
2. Pull up the pinch of the CSI port.
|
|
||||||
|
|
||||||
3. Take your Pi Cam module, and remove the plastic protector from the lens. Make sure that the yellow part of the PCB which has sunny word is installed perfectly (just press gently that yellow part to make sure that it's installed perfectly).
|
|
||||||
|
|
||||||
4. Put in the ribbon cable into the CSI port. Remember, the ribbon cable which has blue tape should be facing towards the Ethernet port. Also, make sure that the ribbon is inserted properly, then pull down the pinch.
|
|
||||||
|
|
||||||
![](https://farm3.staticflickr.com/2938/14529915452_0910b2e13f_z.jpg)
|
|
||||||
|
|
||||||
Now your Pi Cam is ready to take a picture or a video.
|
|
||||||
|
|
||||||
### Enabling Camera on Raspbian ###
|
|
||||||
|
|
||||||
After installing the Pi Cam module, make sure to update your Raspberry Pi system to get the latest firmware. To do so:
|
|
||||||
|
|
||||||
$ sudo apt-get update
|
|
||||||
$ sudo apt-get upgrade
|
|
||||||
|
|
||||||
To activate the Pi Cam module, run the Raspberry Pi configuration tool.
|
|
||||||
|
|
||||||
$ sudo raspi-config
|
|
||||||
|
|
||||||
Navigate to "Enable Camera" in the menu, and make it enabled. Reboot Raspberry Pi if you are done.
|
|
||||||
|
|
||||||
![](https://farm4.staticflickr.com/3837/14530918915_e68ca0beef_z.jpg)
|
|
||||||
|
|
||||||
![](https://farm3.staticflickr.com/2922/14344284230_6cabbe2522_z.jpg)
|
|
||||||
|
|
||||||
![](https://farm3.staticflickr.com/2923/14529915362_7a437a53cb_z.jpg)
|
|
||||||
|
|
||||||
Here is the final picture of Raspberry Pi with Pi Cam module attached.
|
|
||||||
|
|
||||||
![](https://farm3.staticflickr.com/2924/14551046653_1c37e077fd_z.jpg)
|
|
||||||
|
|
||||||
### Taking a Picture with Pi Camera ###
|
|
||||||
|
|
||||||
We are ready to use Pi Cam after rebooting Raspberry Pi. To take a picture with Pi Cam, run raspistill from the command line.
|
|
||||||
|
|
||||||
$ raspistill -o keychain.jpg -t 2000
|
|
||||||
|
|
||||||
This command will take a picture in 2000ms, and save it to keychain.jpg. The following is a picture of my small figurehead key chain, taken by Pi Cam.
|
|
||||||
|
|
||||||
![](https://farm4.staticflickr.com/3845/14530919095_ea0f37045a_z.jpg)
|
|
||||||
|
|
||||||
The raspiyuv tool works similarly, but the result is a unprocessed raw image from the camera.
|
|
||||||
|
|
||||||
### Taking a Video with Pi Camera ###
|
|
||||||
|
|
||||||
To take a video with Pi camera module, run raspivid tool from command line. The following command will take a video with default options which are 5 seconds length and 1920x1080 resolution with 17Mbps bitrate.
|
|
||||||
|
|
||||||
$ raspivid -o mykeychain.h264
|
|
||||||
|
|
||||||
If you want to change the duration, just set the desired length (in milliseconds) with "-t" option.
|
|
||||||
|
|
||||||
$ raspivid -o mykeychain.h264 -t 10000
|
|
||||||
|
|
||||||
To drop the resolution to 1280x720, use "-w" and "-h" options..
|
|
||||||
|
|
||||||
$ raspivid -o mykeychain.h264 -t 10000 -w 1280 -h 720
|
|
||||||
|
|
||||||
The output of raspivid is a raw H.264 video stream, and doesn't have sound with it. To be able to play with a common video player, the raw H.264 video needs to be converted. Use MP4Box application that comes with gpac package.
|
|
||||||
|
|
||||||
To install gpac on Raspbian, use this command:
|
|
||||||
|
|
||||||
$ sudo apt-get install -y gpac
|
|
||||||
|
|
||||||
Then to convert the raw H.264 video stream into .mp4 format with 30 frames per second:
|
|
||||||
|
|
||||||
$ MP4Box -fps 30 -add keychain.h264 keychain.mp4
|
|
||||||
|
|
||||||
The video length is 10 seconds, and has default resolutions and bitrate. Here is an example video captured by Pi Camera.
|
|
||||||
|
|
||||||
注:youtube视频地址
|
|
||||||
<iframe width="615" height="376" frameborder="0" src="http://www.youtube.com/embed/3uyR2AVVwAU?version=3&rel=1&fs=1&showsearch=0&showinfo=1&iv_load_policy=1&wmode=transparent" type="text/html" class="youtube-player"></iframe>
|
|
||||||
|
|
||||||
To get the complete command-line options of raspistill, raspiyuv, and raspivid, run the commands without any option.
|
|
||||||
|
|
||||||
|
|
||||||
----------
|
|
||||||
|
|
||||||
#### [Kristophorus Hadiono][a] ####
|
|
||||||
|
|
||||||
I'm a Linux enthusiast. I use Linux for my daily computing, also when I teach my students. Becoming a good writer is one of my dreams.
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: http://xmodulo.com/2014/07/install-raspberry-pi-camera-board.html
|
|
||||||
|
|
||||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[1]:http://xmodulo.com/go/picam
|
|
||||||
[2]:http://xmodulo.com/go/pinoir
|
|
||||||
[3]:http://xmodulo.com/go/raspberrypi
|
|
||||||
[a]:http://hadiono.org/blog
|
|
@ -0,0 +1,105 @@
|
|||||||
|
如何安装树莓派摄像头模块
|
||||||
|
==============================================================================
|
||||||
|
[树莓派摄像头模块(Pi Cam)][1]发售于2013年5月。在首发时,Pi Cam配备了500万像素的传感器,通过排线链接树莓派上的CSI接口。第二次发布时,Pi Cam改名为[Pi NoIR][2]并配备了相同的传感器,不同之处在于第二版摄像头模块没有红外线过滤装置。因此使用第二版的摄像头模块可以观测到近红外线的波长(700 - 1000 nm),如同一个安全监控摄像机一样,当然实现红外线的感应牺牲了传感器的显色性。
|
||||||
|
|
||||||
|
本文将会展示**如何在[树莓派][3]上安装摄像头模块**。我们会使用第一版摄像头模块来演示。在安装完摄像头模块之后,你将会使用三个应用来访问这个模块:raspistill, raspiyuv 和raspivid。其中前两个应用用来捕捉图像,第三个应用来捕捉视频。raspistill 工具会生成标准的图片文件例如 .jpg 图像,但是 raspiyuv 可以通过摄像头生成未处理的 raw 图像文件。
|
||||||
|
|
||||||
|
### 安装树莓派摄像头模块 ###
|
||||||
|
|
||||||
|
按照以下指示来安装树莓派摄像头模块:
|
||||||
|
|
||||||
|
1. 找到 CSI 接口(CSI接口在以太网接口旁边),掀起深色胶带。
|
||||||
|
|
||||||
|
2. 拉起 CSI 接口挡板。
|
||||||
|
|
||||||
|
3. 将摄像头模块贴在透镜上的塑料保护膜撕掉。确保黄色部分的PCB(有字的一面)是安装完美的。
|
||||||
|
|
||||||
|
4. 将排线插入CSI接口。记住,有蓝色胶带的一面应该面向以太网接口方向。在检查排线安装好了之后,将挡板拉下。
|
||||||
|
|
||||||
|
![](https://farm3.staticflickr.com/2938/14529915452_0910b2e13f_z.jpg)
|
||||||
|
|
||||||
|
好了,现在你的 Pi Cam 已经准备就绪来拍摄相片以及视频了。
|
||||||
|
|
||||||
|
### 在树莓派上启用摄像头模块 ###
|
||||||
|
|
||||||
|
在安装完摄像头模块之后,确认你已经升级了树莓派系统并应用了最新的固件。输入以下命令来更新:
|
||||||
|
|
||||||
|
$ sudo apt-get update
|
||||||
|
$ sudo apt-get upgrade
|
||||||
|
|
||||||
|
运行树莓派配置工具来激活摄像头模块:
|
||||||
|
|
||||||
|
$ sudo raspi-config
|
||||||
|
|
||||||
|
移动光标至菜单中的 "Enable Camera",确认启用。完成之后重启树莓派。
|
||||||
|
|
||||||
|
![](https://farm4.staticflickr.com/3837/14530918915_e68ca0beef_z.jpg)
|
||||||
|
|
||||||
|
![](https://farm3.staticflickr.com/2922/14344284230_6cabbe2522_z.jpg)
|
||||||
|
|
||||||
|
![](https://farm3.staticflickr.com/2923/14529915362_7a437a53cb_z.jpg)
|
||||||
|
|
||||||
|
安装完摄像头模块后的完成照:
|
||||||
|
|
||||||
|
![](https://farm3.staticflickr.com/2924/14551046653_1c37e077fd_z.jpg)
|
||||||
|
|
||||||
|
### 通过摄像头模块拍照 ###
|
||||||
|
|
||||||
|
在重启完树莓派后,我们就可以使用它了。输入以下命令通过摄像头模块拍摄照片:
|
||||||
|
|
||||||
|
$ raspistill -o keychain.jpg -t 2000
|
||||||
|
|
||||||
|
这句命令会在执行 2000ms 之后捕捉图像。然后保存为 keychain.jpg。下面是一张由 下面是一张由 Pi Cam 拍摄的钥匙链。
|
||||||
|
|
||||||
|
![](https://farm4.staticflickr.com/3845/14530919095_ea0f37045a_z.jpg)
|
||||||
|
|
||||||
|
raspivid 工具用法差不多,从命令行运行 raspivid 工具。下面这句命令会按照默认配置(5秒,分辨率1920x1080,比特率 17Mbps)拍摄一段视频。
|
||||||
|
|
||||||
|
$ raspivid -o mykeychain.h264
|
||||||
|
|
||||||
|
如果你想改变拍摄时长,只要通过 "-t" 选项来设置长度就行了。
|
||||||
|
|
||||||
|
$ raspivid -o mykeychain.h264 -t 10000
|
||||||
|
|
||||||
|
使用 "-w" 和 "-h" 选项将分辨率降为 1280x720...
|
||||||
|
|
||||||
|
$ raspivid -o mykeychain.h264 -t 10000 -w 1280 -h 720
|
||||||
|
|
||||||
|
raspivid 的输出是一段未压缩的 H.264 视频流,而且这段视频没有声音。因此这段视频需要转换在能被通常的视频播放器所播放。使用 gpac 包中所带有的 MP4Box 应用。
|
||||||
|
|
||||||
|
在 Raspbian 上安装 gpac,输入命令:
|
||||||
|
|
||||||
|
$ sudo apt-get install -y gpac
|
||||||
|
|
||||||
|
然后将这段 raw 的 H.264 格式的视频流转换为30帧每秒的 .mp4 格式视频:
|
||||||
|
|
||||||
|
$ MP4Box -fps 30 -add keychain.h264 keychain.mp4
|
||||||
|
|
||||||
|
视频长度为10秒,默认分辨率以及比特率。下面是一段通过 Pi Camera 拍摄的一段实例视频。
|
||||||
|
|
||||||
|
注:youtube视频地址
|
||||||
|
|
||||||
|
<iframe width="615" height="376" frameborder="0" src="http://www.youtube.com/embed/3uyR2AVVwAU?version=3&rel=1&fs=1&showsearch=0&showinfo=1&iv_load_policy=1&wmode=transparent" type="text/html" class="youtube-player"></iframe>
|
||||||
|
|
||||||
|
如果想要看到 raspistill, raspiyuv 和 raspivid 的完整命令行选项,直接运行以上命令(不加选项)就行了。
|
||||||
|
|
||||||
|
|
||||||
|
----------------
|
||||||
|
|
||||||
|
### [Kristophorus Hadiono][a] ###
|
||||||
|
|
||||||
|
我是一个 Linux 爱好者。我在日常生活中使用 Linux,甚至在我给学生们教学的时候。我的梦想是成为一名优秀的作家。
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: http://xmodulo.com/2014/07/install-raspberry-pi-camera-board.html
|
||||||
|
|
||||||
|
译者:[ThomazL](https://github.com/ThomazL) 校对:[校对者id](https://github.com/校对者id)
|
||||||
|
|
||||||
|
本文由 [lctt](https://github.com/lctt/translateproject) 原创翻译,[linux中国](http://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[1]:http://xmodulo.com/go/picam
|
||||||
|
[2]:http://xmodulo.com/go/pinoir
|
||||||
|
[3]:http://xmodulo.com/go/raspberrypi
|
||||||
|
[a]:http://hadiono.org/blog
|
||||||
|
|
Loading…
Reference in New Issue
Block a user