OpenCV image processing not running

Question:
My basic code to run an image processing program using python opencv library doesn’t work. The code keeps running and times out. I even upgraded to the paid version assuming it was a CPU issue but that didn’t help either. Running replit on a chrome browser with camera permissions enabled on a macbook.

Repl link:
https://replit.com/@abhidesikan/Curioscope?v=1

import cv2

#capture video from camera
cap = cv2.VideoCapture(1)

while True:
  #read the video frame by frame
  ret, frame = cap.read()

  #display the captured frame
  cv2.imshow('Input', frame)

  #exit the loop if 'q' is pressed
  if cv2.waitKey(1) & 0xFF == ord('q'):
    break

#release the video capture object
cap.release()
cv2.destroyAllWindows()


Hey @abhidesikan!

Your Repl cannot see your camera, it would need to be on your local machine for that.

1 Like