Created
February 20, 2019 23:53
-
-
Save pknowledge/00455e661cede39d8fdc23aff1e725cb to your computer and use it in GitHub Desktop.
Setting Camera Parameters in OpenCV Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
cap = cv2.VideoCapture(0) | |
print(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) | |
print(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) | |
cap.set(3, 3000) | |
cap.set(4, 3000) | |
print(cap.get(3)) | |
print(cap.get(4)) | |
while(cap.isOpened()): | |
ret, frame = cap.read() | |
if ret == True: | |
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) | |
cv2.imshow('frame', gray) | |
if cv2.waitKey(1) & 0xFF == ord('q'): | |
break | |
else: | |
break | |
cap.release() | |
cv2.destroyAllWindows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment