树莓派配置并使用USB摄像头 安装fswebcam应用教程USB摄像头,树莓派5,树莓派4B,树莓派3B/3B+,树莓派zero系列

By 管理员6

2023-11-09 19:20:20

浏览量7258

已赞7

树莓派官方自带的摄像头操作命令 raspistill、raspivid 是无法使用USB的摄像头,今天推荐一款小型摄像头软件‘fswebcam’可以很好的让树莓派使用USB摄像头,操作方法也很简单。

Image


点击查看:适用于莓派USB摄像头

1.先检测树莓派是否识别到了USB摄像头

在树莓派终端LX或者ssh的命令模式下输入命令来查看是否识别到USB摄像头(如下图)

lsusb

Image

如果你的树莓派未识别到USB摄像头设备,请重新插拔一下USB摄像头。或者是你的USB摄像头不支持树莓派。市面上有很多型号都不一定能给树莓派用!

2.安装fswebcam软件

使用USB摄像头需要先给树莓派安装fswebcam软件才能使用

sudo apt-get install fswebcam

Image

我这里显示已经安装过了,所以提示已是最新。

3.测试拍照效果

输入下面这段命令进行测试拍一张照片。(也可以在命令中加入相关参数,比如图片的分辨率,照片的保存路径等等具体可参考教程最后面的使用方法,自行添加)

fswebcam raspi.jpg

Image

拍摄后的照片保存在系统的文件里面。

Image

4.应用参考

比如要拍摄一张分辨率为640*480大小的照片可以修改相关参数

fswebcam -r 640*480 raspi.jpg

Image

网络摄像头会以全分辨率拍摄的照片,并显示底部的横幅和时间。如果要删除横幅,设置图片分辨率或添加--no-banner标志​可以修改命令。

fswebcam -r 1280x720 --no-banner image3.jpg

Image

这样的照片就是1280x720尺寸了,也没有了底部横幅和时间。

5.更多的fswebcam​​​​​​使用方法参考

fswebcam --help
Usage: fswebcam [<options>] <filename> [[<options>] <filename> ... ]
 Options:
 -?, --help                   Display this help page and exit.
 -c, --config <filename>      Load configuration from file.
 -q, --quiet                  Hides all messages except for errors.
 -v, --verbose                Displays extra messages while capturing
     --version                Displays the version and exits.
 -l, --loop <seconds>         Run in loop mode.
 -b, --background             Run in the background.
 -o, --output <filename>      Output the log to a file.
 -d, --device <name>          Sets the source to use.
 -i, --input <number/name>    Selects the input to use.
 -t, --tuner <number>         Selects the tuner to use.
 -f, --frequency <number>     Selects the frequency use.
 -p, --palette <name>         Selects the palette format to use.
 -D, --delay <number>         Sets the pre-capture delay time. (seconds)
 -r, --resolution <size>      Sets the capture resolution.
     --fps <framerate>        Sets the capture frame rate.
 -F, --frames <number>        Sets the number of frames to capture.
 -S, --skip <number>          Sets the number of frames to skip.
     --dumpframe <filename>   Dump a raw frame to file.
 -s, --set <name>=<value>     Sets a control value.
     --revert                 Restores original captured image.
     --flip <direction>       Flips the image. (h, v)
     --crop <size>[,<offset>] Crop a part of the image.
     --scale <size>           Scales the image.
     --rotate <angle>         Rotates the image in right angles.
     --deinterlace            Reduces interlace artifacts.
     --invert                 Inverts the images colours.
     --greyscale              Removes colour from the image.
     --swapchannels <c1c2>    Swap channels c1 and c2.
     --no-banner              Hides the banner.
     --top-banner             Puts the banner at the top.
     --bottom-banner          Puts the banner at the bottom. (Default)
     --banner-colour <colour> Sets the banner colour. (#AARRGGBB)
     --line-colour <colour>   Sets the banner line colour.
     --text-colour <colour>   Sets the text colour.
     --font <[name][:size]>   Sets the font and/or size.
     --no-shadow              Disables the text shadow.
     --shadow                 Enables the text shadow.
     --title <text>           Sets the main title. (top left)
     --no-title               Clears the main title.
     --subtitle <text>        Sets the sub-title. (bottom left)
     --no-subtitle            Clears the sub-title.
     --timestamp <format>     Sets the timestamp format. (top right)
     --no-timestamp           Clears the timestamp.
     --gmt                    Use GMT instead of local timezone.
     --info <text>            Sets the info text. (bottom right)
     --no-info                Clears the info text.
     --underlay <PNG image>   Sets the underlay image.
     --no-underlay            Clears the underlay.
     --overlay <PNG image>    Sets the overlay image.
     --no-overlay             Clears the overlay.
     --jpeg <factor>          Outputs a JPEG image. (-1, 0 - 95)
     --png <factor>           Outputs a PNG image. (-1, 0 - 10)
     --save <filename>        Save image to file.
     --exec <command>         Execute a command and wait for it to complete.


本文章最后由 超级版主2023-11-12 19:19 编辑
发表评论
请先 注册/登录 后参与评论

已有1 发布

默认   热门   正序   倒序
  • 2F
    xczdggf2024-01-05 13:44:01   
    0
查看更多评论
(7) 分享
分享

扫二维码或复制链接分享该篇文章

取消
已有0次打赏
本站免责声明
1、本站资源,均来自网络或个人用户发布,版权归原作者,所有资源和文章仅限用于学习和研究目的 。
2、不得用于商业或非法用途,否则,一切责任由该用户承担 !

侵权删除请致信 E-Mail:cxg88@qq.com