Connect a commercially available webcam to a PC with ubuntu 16.04 installed via USB and capture video with python

Purpose

It is a memorandum when a commercially available webcam is connected to a PC with ubuntu 16.04 installed via USB and a video is captured with python.

Preparation

PC with ubuntu 16.04 installed Commercial webcam

opencv-python installation

pip install opencv-python

test

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()

Coding Error measures

nothing special

reference

Video capture using OpenCV on minimal Ubuntu

Recommended Posts

Connect a commercially available webcam to a PC with ubuntu 16.04 installed via USB and capture video with python
Connect realsense D435 to a PC with ubuntu 16.04 installed and save depth videos with python
[Dedicated to Telewa! ] PC operation with a webcam
Display and shoot webcam video with Python Kivy [GUI]
I installed Ubuntu on a USB stick on a dual boot PC
Try to bring up a subwindow with PyQt5 and Python
Convert video to black and white with ffmpeg + python + opencv
Connect to BigQuery with Python
Connect to Wikipedia with Python
How to make a surveillance camera (Security Camera) with Opencv and Python
I tried to make a periodical process with Selenium and Python
Create a USB boot Ubuntu with a Python environment for data analysis
Try to make a capture software with as high accuracy as possible with python (2)
Connect to postgreSQL from Python and use stored procedures in a loop.
I get a UnicodeDecodeError when trying to connect to oracle with python sqlalchemy
[Pyenv] Building a python environment with ubuntu 16.04
Fractal to make and play with Python
A memo with Python2.7 and Python3 on CentOS
Connect a lot of Python or and and
Connect to MySQL with Python within Docker
I installed and used Numba with Python3.5
Connect to s3 with AWS Lambda Python
Connect to pepper with PEPPER Mac's python interpreter
I tried to make a periodical process with CentOS7, Selenium, Python and Chrome
[ES Lab] I tried to develop a WEB application with Python and Flask ②
Ssh connect to Cisco Catalyst with CentOS7 + Python3 + netmiko and save config locally
WEB scraping with python and try to make a word cloud from reviews
[Python] How to create a local web server environment with SimpleHTTPServer and CGIHTTPServer