I am trying to install OpenCv and run some code on PyCharm on Mac.
I have installed the opencv package as well as numpy but when I run the code this error shows up on Pycharm IDE: "cannot find reference 'VideoCapture' in __init__.py"
In fact, every time I write example_variable = cv2.
, PyCharm is not giving me any option to autocomplete with a function attached to cv2. Why is this happening?
Here's the code I am trying to run. I tried also running other codes but the same error displays:
import cv2
import numpy as np
cap = cv2.VideoCapture()
while True:
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('frame',gray)
if cv2.waitKey(1) & OxFF == ord('q'):
break
cap.release
cv2.destroyAllWindows()
Any tips on how to run this code smoothly? The end goal is to have my front webcam capture live video and react to it.