Capture webcam with Python (OpenCV): step by step

Publicado em: 01 Junho 2017
no canal de: Data Science Garage
137,804
1.8k

This is a part of Python for Image and Video Processing with OpenCV.

In this Python video tutorial I demonstrate how to capture webcam video with Python. Streaming webcam video in real time in Python is very simple processing, just follow the steps I demonstrating on video tutorial.

For this example I used Lifecam VX-1000 and Python 3.5.2.
This method is suitable for any type of external computer camera or laptop camera.

The content of the video tutorial is:
1. Demonstration of video capturing by Python: 0:02
2. Starting coding: 0:29
#0 Import Python modules: cv2, time: 0:31
#1 Create a video object: 0:38
#2 Define Shutdown for camera 1:05
#3 Create a Frame object 1:42
#4 Show the Camera frame on the screen 2:39
#5 Set that any Key (from keyboard) will break the video capturing 3:20
#6 Converting video frame to Grayscale 4:16
#7. THE MOST IMPORTANT MOMENT: make video capturing frames a whole stream 5:18

For make video capturing in frequency to 1 millisecond (every frame is refreshes every 1 millisecond) I use While loop in Python. For testing purposes you can change refreshing interval.

P.S. set Q key for break a capturing: 6:13

Demonstration result of video capturing by Python and break it by press Q key: 7:30.

I hope this video tutorial will be good for python beginners and give you a basic understand how to programming and coding any computer camera.

If you have any comments or questions, just write it below in the comments!


Nesta página do site você pode assistir ao vídeo on-line Capture webcam with Python (OpenCV): step by step duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Data Science Garage 01 Junho 2017, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 137,804 vezes e gostou 1.8 mil espectadores. Boa visualização!