6.2 C
New York
Thursday, March 27, 2025

OpenCV constructed for iOS VIDEOIO(AVFOUNDATION): raised unknown C++ exception


I’ve a static library written in C++ that I’ve compiled for iOS and may use in a iOS take a look at software however I can not use opencv for videoio.

When I attempt to use both

cv::VideoCapture videoReader(filePathThatExistInMySandboxDocumentsFolder.mp4);

or

cv::VideoWriter videoWriter(filePathToNotExistInMySandboxDocumentsFolder.mp4,
 cv::VideoWriter::fourcc('H', '2', '6', '4'), 30, cv::Dimension(1920, 1080), true); 

I get the next exception

[ WARN:[email protected]] world cap.cpp:196 open VIDEOIO(AVFOUNDATION): raised unknown C++ exception!

cap.cpp line 196 I can see that the backend is discovered and that the exception originated from line 150 createCapture however after this I begin to get misplaced.

  1. I’ve constructed OpenCV myself with this feature
    cmake -DCMAKE_TOOLCHAIN_FILE=../platforms/ios/cmake/Toolchains/Toolchain-iPhoneOS_Xcode.cmake -DIOS_ARCH=arm64 -DCMAKE_INSTALL_PREFIX=$OCV_INSTALL -DCMAKE_BUILD_TYPE=Launch -DBUILD_SHARED_LIBS=OFF -DBUILD_opencv_objc=OFF -DBUILD_opencv_apps=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_EXAMPLES=OFF -DWITH_OPENEXR=OFF -DWITH_CAP_IOS=OFF ..
    WITH_CAP_IOS ON or OFF offers the identical exception
    My static library is linked with these opencv libraries
libopencv_core.dylib
libopencv_video.dylib
libopencv_videoio.dylib
libopencv_imgproc.dylib
libopencv_imgcodecs.dylib
libopencv_features2d.dylib
  1. I’ve given the applying permission to make use of the digital camera in case there’s a dependency to the digital camera.
  2. Writing pictures to disk works
  3. The identical code works with out points on MacOS additionally utilizing AVFoundation because the backend
  4. AVFoundation.framework is added to Construct Phases -> Hyperlink Binary with Libraries
  5. The identical code runs with out issues on MacOS with opencv constructed for that platform

and I’ve run out of concepts of what to examine subsequent to have the ability to learn and write movies on iOS utilizing OpenCV?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles