Member-only story

OpenCV Series — 3— Read video from webcam

Rajathithan Rajasekar
2 min readMay 7, 2020

--

OpenCV Read Video from Webcam

In this post , we are going to see how we can read video from a webcam using openCV and display the frames per second on the gui window.

imutils — this package contains lot of image processing funtions, we will use the resize function from this package, to resize the frame to the desired resolution of our choice.

cv2.getTickCount function returns the number of clock-cycles after a reference event and cv2.getTickFrequency function returns the frequency of clock-cycles, or the number of clock-cycles per second. We use it to calculate the frames per second.

cv2.putText() is used for placing the text on the display frame.

cv2.waitKey(10) — will wait for an keyboard press even of letter “ Q” and cv2.getWindowProperty(winname,cv2.WND_PROP_VISIBLE) — will wait for the mouse event which changes the active windows property id. Both of these values are used to close the webcam feed.

webcam feed

I hope this content helped you to understand reading the video feed from a webcam, if you liked this content , give a clap. Thanks.

Previous-Post………………………………………………………Next-Post

--

--

Rajathithan Rajasekar
Rajathithan Rajasekar

Written by Rajathithan Rajasekar

I like to write code in Python . Interested in cloud , dataAnalysis, computerVision, ML and deepLearning. https://rajathithanrajasekar.medium.com/membership

No responses yet