Created
January 14, 2019 05:26
-
-
Save bigsnarfdude/906af9bf6e0ba94f47708d827e7831e8 to your computer and use it in GitHub Desktop.
setting fps in cv2
This file contains 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
def grab(cam, queue, width, height, fps): | |
global running | |
capture = cv2.VideoCapture(cam) | |
capture.set(cv2.CAP_PROP_FRAME_WIDTH, width) | |
capture.set(cv2.CAP_PROP_FRAME_HEIGHT, height) | |
capture.set(cv2.CAP_PROP_FPS, fps) | |
while(running): | |
frame = {} | |
capture.grab() | |
retval, img = capture.retrieve(0) | |
frame["img"] = img | |
frame["1"] = config["1"] | |
frame["2"] = config["2"] | |
blur = get_blur(img, 0.05) | |
frame["blur"] = blur | |
if queue.qsize() < 10: | |
queue.put(frame) | |
else: | |
print(queue.qsize()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment