LoginSignup
1
11

More than 5 years have passed since last update.

Python+OpenCVによるカメラからの画像取得

Posted at

主に個人的なメモです。
以下のコードをCtrl+C & Ctrl+Vして実行すると動きます。

環境
・Python2.7
・OpenCV2

capture.py
import cv2

cap = cv2.VideoCapture(0)

while(True):

    # Capture frame-by-frame
    ret, frame = cap.read()

    # Display the resulting frame
    cv2.imshow('frame', frame)
    if cv2.waitKey(1) == 27:
        break

# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
1
11
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
11