opencv / opencv-python

Automated CI toolchain to produce precompiled opencv-python, opencv-python-headless, opencv-contrib-python and opencv-contrib-python-headless packages.
https://pypi.org/project/opencv-python/
MIT License
4.44k stars 835 forks source link

OpenCV Camera Error on M1 MacBook Pro #576

Closed Shreyas-dotcom closed 2 years ago

Shreyas-dotcom commented 2 years ago

2021-11-01 10:16:09.596 Python[45041:1449940] Error loading /Library/CoreMediaIO/Plug-Ins/DAL/XSplit VCam.plugin/Contents/MacOS/XSplit VCam: dlopen(/Library/CoreMediaIO/Plug-Ins/DAL/XSplit VCam.plugin/Contents/MacOS/XSplit VCam, 0x0106): tried: '/Library/CoreMediaIO/Plug-Ins/DAL/XSplit VCam.plugin/Contents/MacOS/XSplit VCam' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/XSplit VCam' (no such file) OpenCV: out device of bound (0-0): 1 OpenCV: camera failed to properly initialize!

I'm really worried- How should this be fixed?

alalek commented 2 years ago

XSplit VCam incompatible architecture

Wrong bug tracker.

Shreyas-dotcom commented 2 years ago

Is there any way to get this working on the M1 Mac?

abhiTronix commented 2 years ago

@Shreyas-dotcom Not related to opencv.

geyang commented 11 months ago

Running into same error, without using other libraries. Here the example to replicate:

import cv2 as cv

cap = cv.VideoCapture(-1)

if not cap.isOpened():
  print("Cannot open camera")
  exit()

while True:
  print('start reading frames')

  # Capture frame-by-frame
  ret, frame = cap.read()

  print("ret", ret)
  print("frame", frame)

  # if frame is read correctly ret is True
  if not ret:
    print("Can't receive frame (stream end?). Exiting ...")
    break

  break

  # Our operations on the frame come here
  # gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
  # Display the resulting frame
  # cv.imshow('frame', gray)
  print("image size:", gray.size)

  if cv.waitKey(1) == ord('q'):
    break

# When everything done, release the capture
cap.release()
cv.destroyAllWindows()

outputs

OpenCV: not authorized to capture video (status 0), requesting...
Cannot open camera
OpenCV: camera failed to properly initialize!