-
Notifications
You must be signed in to change notification settings - Fork 1
/
reading_images.py
29 lines (22 loc) · 909 Bytes
/
reading_images.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import cv2 as cv
#img = cv.imread(r'C:\Users\Supravo\OneDrive\Desktop\BS\summerschool2024\sahaaysummerschool2024\deer.jpg')
#cv.imshow('IITMdeer', img)
#cv.waitKey(0)
# Initialize a video capture object for the default camera (0).
capture = cv.VideoCapture('forest.mp4')
# Start an infinite loop to continuously capture frames from the camera.
while True:
# Capture the current frame.
# isTrue will be True if the frame was successfully captured.
# frame contains the captured frame.
isTrue, frame = capture.read()
# Display the captured frame in a window named 'Video'.
cv.imshow('Video', frame)
# Wait for 20 milliseconds for a key press.
# If the 'd' key is pressed, exit the loop.
if cv.waitKey(20) & 0xFF==ord('d'):
break
# Release the capture object, freeing up the camera.
capture.release()
# Close all OpenCV windows.
cv.destroyAllWindows()