Skip to content

Unable to initialize camera #13

@rsingh2083

Description

@rsingh2083

Changed the lines as suggested by 3 other people on the forum to

 def start_webcam(self):
        if not self.camera_is_running:
            self.capture = cv2.VideoCapture(0)  # VideoCapture(0) sometimes drops error #-1072875772
            if self.capture is None:
            	self.capture = cv2.VideoCapture(0)

But still this error :--

VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV
Unable to stop the stream: Device or resource busy
VIDEOIO ERROR: V4L: can't open camera by index 0
Traceback (most recent call last):
  File "main.py", line 45, in update_frame
    self.display_image(base_image)
  File "main.py", line 100, in display_image
    if len(img.shape) == 3:
AttributeError: 'NoneType' object has no attribute 'shape'
Aborted (core dumped)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions