LoginSignup
1
2

More than 3 years have passed since last update.

ubuntu16.04をインストールしたPCに市販のWebカメラをUSB接続してpythonで動画キャプチャする

Posted at

目的

ubuntu16.04をインストールしたPCに市販のWebカメラをUSB接続してpythonで動画キャプチャした際の備忘録です

準備

ubuntu16.04をインストールしたPC
市販のWebカメラ

opencv-pythonインストール

pip install opencv-python

テスト

capture.py
import cv2
cap = cv2.VideoCapture(0)

while True:
    ret, img = cap.read()
    cv2.imshow('video', img)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
cap.release()
cv2.destroyAllWindows()

CodingError対策

特になし

参考

最小限のUbuntuでOpenCVを使用したビデオキャプチャ

1
2
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
1
2