I agree with the comments above, more details are needed to know exactly how you are planning connect your camera. Here’s a working example for a webcam, notice that you should replace the input_id
with your camera’s. You would work on frame
for further processing.
import cv2
def get_video(input_id):
camera = cv2.VideoCapture(input_id)
while True:
okay, frame = camera.read()
if not okay:
break
cv2.imshow('video', frame)
cv2.waitKey(1)
pass
if __name__ == '__main__':
get_video(0)