树莓派上使用摄像头

一、第一步更新firmware

rpi-update是老外开发的一个更新树莓派firmware的工具,很方便也很好用,推荐给大家!
  红色部分是需要输入的:
  $ sudo apt-get update      
  $ sudo apt-get install ca-certificates
  $ sudo apt-get install git-core
  $ sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update
  $ sudo chmod +x /usr/bin/rpi-update
  $ sudo rpi-update
  Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS
  Performing self-update
  Autodetecting memory split
  Using ARM/GPU memory split of 192MB/64MB
  We're running for the first time
  Setting up firmware (this will take a few minutes)
  Using SoftFP libraries
  /opt/vc/sbin/vcfiled: error while loading shared libraries:libvchiq_arm.so: cannot open shared object file: No such file or directory
  If no errors appeared, your firmware was successfully setup
  A reboot is needed to activate the new firmware
  $ sudo ldconfig
  $ sudo rpi-update
  Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS
  Performing self-update
  Autodetecting memory split
  Using ARM/GPU memory split of 192MB/64MB
  Updating firmware (this will take a few minutes)
  Your firmware is already up to date
  $ sudo reboot
备注:
09-18版本以后的官方镜像都集成了rpi-update工具,直接执行“sudo rpi-update”就行了,不需要再安装了


二、检查摄像头链接情况

插上usb摄像头,输入ls /dev, 查看dev中是否存在一个video0这个设备,如果有了说明系统识别了,如果不认,重复第一步确保firmware最新,还不行就换摄像头吧。


三、安装mplayer

输入sudo apt-get install mplayer


四、输入命令播放摄像头视频:sudo mplayer tv://


建议大家将摄像头接在usb HUB上,我发现直接连很不稳定,我猜可能和供电有关系!

你可能感兴趣的:(物联网开发,机器人开发,树莓派链接摄像头)