Skip to content

[iOS] VideoCapture.open(0) throws "error: (-215:Assertion failed) !info.backendFactory.empty()". #19910

@utibenkei

Description

@utibenkei
System information (version)
  • OpenCV => 4.5.2 69357b1
  • Operating System / Platform => macOS Catalina 10.15.7
  • Xcode => 12.3
  • CMake => 3.19.8
Detailed description

VideoCapture.open(0) throws "error: (-215:Assertion failed) !info.backendFactory.empty()".

terminating with uncaught exception of type cv::Exception: OpenCV(4.5.2-dev) /Users/satoo/opencv/ios/opencv/modules/videoio/src/cap.cpp:239: error: (-215:Assertion failed) !info.backendFactory.empty() in function 'open'

The same error occurs with the following method.
bool VideoCapture::open(const String& filename, int apiPreference)
bool VideoWriter::open(const String& filename, int _fourcc, double fps, Size frameSize, bool isColor)

This commit may be the cause.
e705414

Steps to reproduce
  1. build opencv2.framework.
    python opencv/platforms/ios/build_framework.py --contrib opencv_contrib --dynamic output
  2. Open "output/samples/FaceDetection" project and edit ViewController.swift. https://github.com/opencv/opencv/blob/master/samples/swift/ios/FaceDetection/FaceDetection/ViewController.swift#L86
   @IBOutlet weak var cameraHolder: UIView!
    override func viewDidLoad() {
        super.viewDidLoad()
        
+        var cap = VideoCapture()
+        cap.open(index: 0)
        
        camera = CvVideoCamera2(parentView: cameraHolder)
        camera?.rotateVideo = true
        camera?.delegate = self
        camera?.start()
    }
  1. Run FaceDetection project on device.

screenshot

This error occurs even when using the official release of opencv2.framework.
https://sourceforge.net/projects/opencvlibrary/files/4.5.2/opencv-4.5.2-ios-framework.zip/download

Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found solution
  • I updated to latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions