CV2: "[ WARN:0] terminating async callback" when attempting to take a picture

I had the same warning. Just modify the line camera = cv2.VideoCapture(camera_port) to camera = cv2.VideoCapture(camera_port, cv2.CAP_DSHOW) and add cv2.destroyAllWindows() as the last line of your code.


It's probably showing a warning because you're not releasing the handle to the webcam.

try adding this to the end of the code

camera.release()
cv2.destroyAllWindows()

I hope this helps!


camera = cv2.VideoCapture(camera_port,cv2.CAP_DSHOW)

cv2.destroyAllWindows()

Tags:

Python

Image

Cv2