<p dir="auto">Hi ,<br>
I used the VideoCapture function to call the camera, but something went wrong. Is this a bug? My CV version is 4.5.3 .<br>
import cv2<br>
cap = cv2.VideoCapture(0)<br>
while True:<br>
ret,frame=cap.read()<br>
gray=cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)<br>
cv2.imshow('WindowName',gray)<br>
if cv2.waitKey(1)&amp;0xFF==ord('q'):<br>
break<br>
cap.release()<br>
cv2.destroyAllWindows()</p>
<p dir="auto">cv2.error: OpenCV(4.5.3) /Users/runner/miniforge3/conda-bld/libopencv_1633800950233/work/modules/videoio/src/cap.cpp:239: error: (-215:Assertion failed) !info.backendFactory.empty() in function 'open'</p>
<p dir="auto">The above exception was the direct cause of the following exception:</p>
<p dir="auto">Traceback (most recent call last):<br>
File "/Users/master/python/cv2video.py", line 2, in <br>
cap = cv2.VideoCapture(0)<br>
SystemError: &lt;class 'cv2.VideoCapture'&gt; returned a result with an error set</p>
<p dir="auto">The above exception was the direct cause of the following exception:</p>
<p dir="auto">Traceback (most recent call last):<br>
File "/Users/master/python/cv2video.py", line 2, in <br>
cap = cv2.VideoCapture(1)<br>
SystemError: &lt;class 'cv2.VideoCapture'&gt; returned a result with an error set</p>
<h5 dir="auto">System information (version)</h5>

<ul dir="auto">
<li>OpenCV =&gt; 3.4.2</li>
<li>Operating System / Platform = macOS 10.13.6</li>
<li>Compiler = Xcode Version 10.0 beta 6 (10L232m)</li>
</ul>
<h5 dir="auto">Detailed description</h5>
<p dir="auto">OpenCV iOS framework build fails against most recent Xcode 10 beta. The following error occurs:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="CMake Error at cmake/OpenCVCompilerOptimizations.cmake:458 (message):
  Required baseline optimization is not supported: NEON
  (CPU_BASELINE_REQUIRE=;NEON)
Call Stack (most recent call first):
  cmake/OpenCVCompilerOptions.cmake:259 (include)
  CMakeLists.txt:555 (include)


-- Performing Test HAVE_CPU_BASELINE_FLAGS
-- Performing Test HAVE_CPU_BASELINE_FLAGS - Failed
CMake Error at cmake/OpenCVCompilerOptimizations.cmake:505 (message):
  Compiler doesn't support baseline optimization flags:
Call Stack (most recent call first):
  cmake/OpenCVCompilerOptions.cmake:261 (ocv_compiler_optimization_options)
  CMakeLists.txt:555 (include)"><pre class="notranslate"><code class="notranslate">CMake Error at cmake/OpenCVCompilerOptimizations.cmake:458 (message):
  Required baseline optimization is not supported: NEON
  (CPU_BASELINE_REQUIRE=;NEON)
Call Stack (most recent call first):
  cmake/OpenCVCompilerOptions.cmake:259 (include)
  CMakeLists.txt:555 (include)


-- Performing Test HAVE_CPU_BASELINE_FLAGS
-- Performing Test HAVE_CPU_BASELINE_FLAGS - Failed
CMake Error at cmake/OpenCVCompilerOptimizations.cmake:505 (message):
  Compiler doesn't support baseline optimization flags:
Call Stack (most recent call first):
  cmake/OpenCVCompilerOptions.cmake:261 (ocv_compiler_optimization_options)
  CMakeLists.txt:555 (include)
</code></pre></div>
<p dir="auto">I realize that this is a <em>beta</em> version of Xcode, but the final version is expected to be released next week, and I was hoping someone else may have seen this issue. Full log is here: <a href="https://gist.github.com/amrox/522e7968c5badbb2fdd168068843e808">https://gist.github.com/amrox/522e7968c5badbb2fdd168068843e808</a></p>
<p dir="auto">This seems very similar to<br>
<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="283513765" data-permission-text="Title is private" data-url="https://github.com/opencv/opencv/issues/10363" data-hovercard-type="issue" data-hovercard-url="/opencv/opencv/issues/10363/hovercard" href="https://github.com/opencv/opencv/issues/10363">#10363</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="237156692" data-permission-text="Title is private" data-url="https://github.com/opencv/opencv/issues/8945" data-hovercard-type="issue" data-hovercard-url="/opencv/opencv/issues/8945/hovercard" href="https://github.com/opencv/opencv/issues/8945">#8945</a> but this issue is said to be fixed in 3.4.1, and I'm still seeing it in 3.4.2 and 3.4.3.</p>
<p dir="auto">Finally this <em>only</em> happens when using the Xcode beta toolchain. If I switch back to Xcode 9.4.1 (9F2000) it builds fine.</p>
<h5 dir="auto">Steps to reproduce</h5>
<ol dir="auto">
<li>Checkout opencv, tested against <code class="notranslate">3.4.3</code> <code class="notranslate">3.4.2</code> and <code class="notranslate">d74b98c3d9264f9623b27a8d4e0fc92ac97b71d0</code></li>
<li>build iOS framework with: <code class="notranslate">python platforms/ios/build_framework.py build/ios</code></li>
</ol>
<p dir="auto">Edit:</p>
<p dir="auto">It appears the real problem is due to the fact that libstdc++ is deprecated in Xcode 10 / iOS 12 toolchain and Apple wants you to move to libc++</p>
<p dir="auto">CMakeError.log: <a href="https://github.com/opencv/opencv/files/2352853/CMakeError.log">CMakeError.log</a></p>