Created
June 25, 2018 23:19
-
-
Save yoelk/f9c6b0aada610391127fffa488afa7df to your computer and use it in GitHub Desktop.
Small sample code that uses OpenCV to show images from a camera. If an mp.Manager is created, the code stops working. Commenting the line fixes it but why???
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
import cv2 | |
import multiprocessing as mp | |
cap = cv2.VideoCapture(0) | |
manager = mp.Manager() # Comment this line to make the code work | |
with mp.Lock(): | |
cap.set(6, cv2.VideoWriter_fourcc(*list('MJPG'))) | |
ESC = 27 | |
while(True): | |
ret, frame = cap.read() | |
cv2.imshow('frame', frame) | |
if cv2.waitKey(1) & 0xFF == ESC: | |
break | |
cap.release() | |
cv2.destroyAllWindows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment