LoginSignup
6
7

More than 5 years have passed since last update.

webカメラによる書籍ISBNバーコード解析

Last updated at Posted at 2018-12-14

背景

バーコードリーダーが普及されているが、業務用なので、超小規模システム、個人などではなかなか
手を出しづらい、それで、ノートパソコンのカメラを流用できないかを調査してみました。

目標

ノートパソコンのカメラに書籍の裏面を映したら、ISBNバーコードを読み取り、コードを返す。

環境

python   3.7
opencv2  3.4.4.19
pyzbar   0.1.7

ライブラリ のインストール

pip install opencv-python
pip install pyzbar

カメラの使用方法

capture = cv2.VideoCapture(0) # カメラ番号 capture = cv2.VideoCapture(1)
cv2.namedWindow("Capture", cv2.WINDOW_AUTOSIZE)
while True:
    ret, image = capture.read()
    if ret == False:
        continue
    image_mirror = image[:,::-1]
    cv2.imshow("Capture", image_mirror )
    keyInput = cv2.waitKey(3) 
    if keyInput == 27: # when ESC
        break

全体ソース

ソースコード

感想

web カメラでも高い認識率でバーコードを認識していることが分かった。pyzbarを開発した方に感謝!

6
7
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
6
7