Merge pull request #2457 from geekpi/master

translated
This commit is contained in:
geekpi 2015-03-01 13:58:13 +08:00
commit ff514326ee
2 changed files with 63 additions and 65 deletions

View File

@ -1,65 +0,0 @@
Translating----geekpi
Linux FAQs with Answers--How to install a USB webcam in Raspberry Pi
================================================================================
> **Question**: Can I use a standard USB-based webcam on Raspberry Pi? How can I check if my USB webcam is compatible with Raspberry Pi, and how can I install it on Raspberry Pi?
If you want to take pictures or record videos using Raspberry Pi board, you can install [Raspberry Pi camera board][1]. If you do not want to shell out money just for the camera board module, there is yet another way, which is to utilize a commonly found [USB web camera][2]. You may already have one for your PC.
In this tutorial, we show how to set up a USB web camera on Raspberry Pi board. We assume that you are using Raspbian operation system.
Before we start, it is better to check if your USB web camera is [one of those][3] which are known to be compatible with Raspberry Pi. If your USB webcam is not found in the compatibility list, don't be discouraged, as there is still a chance that your USB web camera may be detected by Raspberry Pi.
### Check if a USB Webcam is Compatible with Raspberry Pi ###
To check whether your USB web camera is detected on Raspberry Pi or not, plug it into the USB port of your Raspberry Pi, and type lsusb command in the terminal.
$ lsusb
If the output of the command does not list your webcam, there is a possibility that this is because your Raspberry Pi doesn't supply enough power needed for your USB web camera. In this case, you can try using a separate power line for the USB web camera, such as [USB power hub][4], and then repeat the lsusb command. If the USB webcam is still not recognized, we can only suggest you buy another USB web camera which is supported by Raspberry Pi.
![](https://farm8.staticflickr.com/7408/16576646025_898f17f36e_o.png)
In the above screenshot, the USB web camera is detected as "1e4e:0102", but it doesn't show the maker or the name of the web camera. When we try it with Fedora 20 in a laptop, it is successfully detected as "1e4e:0102 Cubeternet GL-UPC822 UVC WebCam."
Another way to check if your USB web camera is supported by Raspberry Pi is by checking the /dev directory. If there is /dev/video0, this implies that your USB webcam is recognized by Raspberry Pi.
### Take a Picture with USB Webcam ###
After your USB webcam is successfully hooked up with Raspberry Pi, the next thing to do is to take some pictures to verify its functionality.
For this, you can install fswebcam, which is a small webcam application. You can install fswebcam directly from the Raspbian repository as follows.
$ sudo apt-get install fswebcam
Once fswebcam is installed, run the following command in a terminal to capture a picture from the USB webcam:
$ fswebcam --no-banner -r 640x480 image.jpg
This command will capture a picture with 640x480 resolution, and save it as image.jpg. It will not put any banner in the bottom part of the picture.
![](https://farm8.staticflickr.com/7417/16576645965_302046d230_o.png)
Here is the result from the fswebcam command with 640x480 resolution.
![](https://farm8.staticflickr.com/7345/16575497512_8d77f1b34c_o.jpg)
The next example picture is captured without defining the resolution. The picture color is blueish, and the default resolution is only 358x288.
![](https://farm8.staticflickr.com/7390/15954067124_760fbcdd9c_o.jpg)
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/install-usb-webcam-raspberry-pi.html
作者:[Kristophorus Hadiono][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://ask.xmodulo.com/author/kristophorus
[1]:http://xmodulo.com/install-raspberry-pi-camera-board.html
[2]:http://xmodulo.com/go/usb_webcam
[3]:http://elinux.org/RPi_USB_Webcams
[4]:http://xmodulo.com/go/usb_powerhub

View File

@ -0,0 +1,63 @@
Linux有问必答 -- 如何在树莓派上安装USB网络摄像头
================================================================================
> **Question**: 我可以在树莓派上使用标准的USB网络摄像头么我该如何检查USB网络摄像头与树莓派是否兼容另外我该如何在树莓派上安装它
如果你想在树莓上拍照或者录影,你可以安装[树莓派的摄像头板][1]。如果你不想要为摄像头模块花费额外的金钱,那有另外一个方法,就是你常见的[USB 摄像头][2]。你可能已经在PC上安装了。
本教程中我会展示如何在树莓派上设置摄像头。我们假设你使用的系统是Raspbian。
在此之前,你最好检查一下你的摄像头是否在[这些][3]已知与树莓派兼容的摄像头之中。如果你的摄像头不在这个兼容列表中,不要丧气,仍然有可能你的摄像头被树莓派检测到。
### 检查USB摄像头是否雨树莓派兼容 ###
要检查你的摄像头是否可以被树莓派检测到将它插入到树莓派的USB口中然后输入下面的命令。
$ lsusb
如果输出中没有你的摄像头,那么有可能你的树莓派的电源无法供应足够的电力给你的摄像头。这时你可以给你的摄像头用独立的电源线,比如[有源USB hub][4]并重新输入lsusb命令。如果摄像头还是不能被识别我们只有建议你购买其他树莓派支持的摄像头了。
![](https://farm8.staticflickr.com/7408/16576646025_898f17f36e_o.png)
在上面的截屏中USB摄像头被识别为“1e4e:0102”但是没有显示摄像头的制造商。当你在笔记本的Fedora 20中使用它时它可以成功的检测到“1e4e:0102 Cubeternet GL-UPC822 UVC WebCam”。
另外一个可以检查摄像头是否被树莓派支持的方法是检查/dev目录。如果有/dev/video0那么这暗示树莓派支持你的摄像头。
### 用USB Webcam拍照片 ###
当USB摄像头成功挂载到树莓派上之后下一步就是拍一些照片来验证它的功能了。
要想拍摄照片你要安装fswebcam这是一款小型摄像头程序。你可以直接通过Raspbian的仓库来安装fswebcam。
$ sudo apt-get install fswebcam
fswebcam安装完成后在终端中运行下面的命令来抓去一张来自摄像头的照片
$ fswebcam --no-banner -r 640x480 image.jpg
这条命令可以抓取一张640x480分辨率的照片并且用jpg格式保存。它不会在照片的地步留下任何标志.
![](https://farm8.staticflickr.com/7417/16576645965_302046d230_o.png)
这就是fswebcam下640x480分辨率的结果。
![](https://farm8.staticflickr.com/7345/16575497512_8d77f1b34c_o.jpg)
下面的例子是没有定义分辨率的照片。图片是偏蓝的并且默认的分辨率是358x288。
![](https://farm8.staticflickr.com/7390/15954067124_760fbcdd9c_o.jpg)
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/install-usb-webcam-raspberry-pi.html
作者:[Kristophorus Hadiono][a]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://ask.xmodulo.com/author/kristophorus
[1]:http://xmodulo.com/install-raspberry-pi-camera-board.html
[2]:http://xmodulo.com/go/usb_webcam
[3]:http://elinux.org/RPi_USB_Webcams
[4]:http://xmodulo.com/go/usb_powerhub