17 lines
335 B
Python
17 lines
335 B
Python
import cv2
|
|
|
|
# Open the video file (use video file or webcam, here using webcam)
|
|
cap = cv2.VideoCapture(0)
|
|
|
|
width = 1280
|
|
height = 720
|
|
|
|
# Set the resolution and fps of the camera
|
|
cap.set(cv2.CAP_PROP_FRAME_WIDTH, width)
|
|
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, height)
|
|
|
|
result, image = cap.read()
|
|
|
|
cv2.imwrite('test.jpg', image)
|
|
|
|
cap.release() |