0% found this document useful (0 votes)
48 views1 page

OpenCV Video Capture Example

The document shows code to capture video frames from a camera using OpenCV, display the frames, and quit when the 'q' key is pressed.

Uploaded by

Trần Xuân
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views1 page

OpenCV Video Capture Example

The document shows code to capture video frames from a camera using OpenCV, display the frames, and quit when the 'q' key is pressed.

Uploaded by

Trần Xuân
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

# import the opencv library

import cv2

# define a video capture object


vid = [Link](0)

while(True):
   
    # Capture the video frame
    # by frame
    ret, frame = [Link]()

    # Display the resulting frame


    [Link]('frame', frame)
   
    # the 'q' button is set as the
    # quitting button you may use any
    # desired button of your choice
    if [Link](1) & 0xFF == ord('q'):
        break

# After the loop release the cap object


[Link]()
# Destroy all the windows
[Link]()

You might also like