【问题标题】:using fswebcam and fbi to display images使用 fswebcam 和 fbi 显示图像
【发布时间】:2015-04-04 08:33:48
【问题描述】:

我正在用我的树莓派做一个小项目。我有一个网络摄像头和一个piTFT 显示器。我想写一个shell脚本,迭代地使用网络摄像头拍照,然后将图片显示在piTFT上。我想通过 SSH 运行脚本。

我已经成功地这样做了,使用fswebcam 捕获图像,并使用fbi 在 piTFT 上显示图像。脚本很简单:运行一个 while 循环(直到按下一个按键),然后在每次迭代中拍摄一张照片并显示出来:

#!/bin/bash
if [ -t 0 ]; then stty -echo -icanon -icrnl time 0 min 0; fi

count=0
keypress=''
while [ "x$keypress" = "x" ]; do

    # update console
    let count+=1
    echo ---------Taking image $count---------

    # take picture
    fswebcam -r 320x240 -q image.jpg

    # display on PITFT
    sudo fbi -T 2 -d /dev/fb1 --noverbose -a image.jpg

    sleep 0.1 
    keypress="`cat -v`"
done

if [ -t 0 ]; then stty sane; fi
exit 0

问题出在这里:我已经尝试了所有我能想到的让 fbi “安静”运行(使用 noverbose 选项等),但我仍然在控制台中看到这条线:

using "DejaVu Sans Mono-16", pixelsize=16.67 file=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf

有没有办法抑制这个输出?

【问题讨论】:

    标签: bash raspberry-pi


    【解决方案1】:

    尝试将fbistdoutstderr重定向到/dev/null

    sudo fbi -T 2 -d /dev/fb1 --noverbose -a image.jpg >/dev/null 2>&1
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-19
      • 1970-01-01
      • 2020-04-13
      • 2018-05-28
      • 2019-03-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多