使用 fswebcam 和 fbi 显示图像

using fswebcam and fbi to display images

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

我已经成功地做到了,使用 fswebcam to capture the image, and 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 到 运行 'quietly'(使用 noverbose 选项等),但我仍然在控制台中看到这一行:

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

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

尝试将 fbi stdoutstderr 重定向到 /dev/null:

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