macos – Python OpenCv can open external webcam but can’t show image

I’m trying to read and image from VideoCapture from an external webcam on my mac, but I’m not able to display the image. Here what I’m using:

  • Python: 3.9.1
  • opencv-contrib-python:
  • MacOS Big Sur 11.2.3

I’m running the script from the command line, and I’m pretty sure that I gave all the permissions needed. Everything is working fine on my friend’s laptop using Linux. I’m able to see the webcam image when i’m using FaceTime or Photo Booth.

Here’s the code:

class Camera:
    def __init__(self, camera_index: int):
        self._camera_index = camera_index
        self._capture = None

    def take_world_image(self):
        return self._get_camera_frame()

    def _get_camera_frame(self):
        opened_successfully, current_frame =
        if not opened_successfully:
            raise InvalidCameraConfigException
        return current_frame

    def _open_capture(self):
        self._capture = cv2.VideoCapture(self._camera_index)
    def _close_capture(self):

if __name__ == "__main__":
    camera = Camera(1)
    while True:
        image = camera.take_world_image()
        cv2.imshow("image", image)
        if cv2.waitKey(1) & 0xFF == ord("q"):

open_successfully return True, but this is the image I’m getting:

Thank you for your help!