LoginSignup
2
5

More than 5 years have passed since last update.

python-zbarを使って画面表示無しでWebカメラを利用する

Last updated at Posted at 2016-07-06

ネットワーク上のRaspberry PiでSSH経由でWebカメラを利用する時に、サンプル通りにproc.init(device)としてしまうと、画面表示が出来ないためエラーが発生する。

 proc.init(device)
 zbar.SystemError: ERROR: zbar processor in zbar_processor_init():
 system error: spawning input thread: Invalid argument (22)

SSHに-Xオプションを付けると大丈夫だけれど、そもそもアプリケーションとして画面表示が必要ないことも多いので、そういう場合の対処方法のメモ。

import zbar
proc = zbar.Processor()
device = '/dev/video0'
proc.init(device, False)

この記事によると、ドキュメントには載っていないものの、Processorの初期化にデバイス名と、Falseを与えてあげればいいとのこと。

参考

2
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
5