我花了比我愿意承认的时间更多的时间,尝试将Beaglebone Black安装起来并与OpenCV和摄像机一起运行。但是,手动编译OpenCV 4.0.0并尝试使用Python绑定初始化相机后,它仍然会失败。
使用v4l2-ctl,我既可以在终端上查看和设置格式等,也可以尝试简单的操作
import cv2
vs = cv2.VideoCapture(0)
retVal, frame = vs.read()
这将产生:
>> select timeout
>> VIDIOC_DQBUF: Resource temporarily unavailable
我尝试使用和没有我能想到的与相机相关的所有东西来编译OpenCV-libv4l-dev,ffmpeg,gstreamer-没运气...
相机在Raspberry Pi和我的PC上都可以正常工作,而且很有趣-我尝试使用apt-get安装OpenCV,这使相机正常工作。
所以
sudo apt-get install python-opencv
可安装OpenCV 3.2.0(不对arm进行任何硬件优化)。.
你们中有人会知道我在这里想念的吗? OpenCV 4.0.0中仅存在一个bug,而3.x.x中没有该bug?
有关更多信息,我在下面附上了我的构建概述:
cmake -D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_INSTALL_PREFIX=/usr/local
-D ENABLE_NEON=ON
-D ENABLE_VFPV3=ON
-D BUILD_TESTS=OFF
-D INSTALL_PYTHON_EXAMPLES=OFF
-D BUILD_EXAMPLES=OFF
-D WITH_JPEG=ON
-D BUILD_JPEG=OFF
-D JPEG_INCLUDE_DIR=/opt/libjpeg-turbo/include/
-D JPEG_LIBRARY=/opt/libjpeg-turbo/lib32/libjpeg.a
-D WITH_V4L=ON ..
-- Looking for ccache - not found
-- FP16 is not supported by C++ compiler
-- Found ZLIB: /usr/lib/arm-linux-gnueabihf/libz.so (found suitable version "1.2.8", minimum required is "1.2.3")
-- Could NOT find Jasper (missing: JASPER_LIBRARIES JASPER_INCLUDE_DIR)
-- Found ZLIB: /usr/lib/arm-linux-gnueabihf/libz.so (found version "1.2.8")
-- Checking for module 'gstreamer-base-1.0'
-- No package 'gstreamer-base-1.0' found
-- Checking for module 'gstreamer-video-1.0'
-- No package 'gstreamer-video-1.0' found
-- Checking for module 'gstreamer-app-1.0'
-- No package 'gstreamer-app-1.0' found
-- Checking for module 'gstreamer-riff-1.0'
-- No package 'gstreamer-riff-1.0' found
-- Checking for module 'gstreamer-pbutils-1.0'
-- No package 'gstreamer-pbutils-1.0' found
-- Checking for module 'gstreamer-base-0.10'
-- No package 'gstreamer-base-0.10' found
-- Checking for module 'gstreamer-video-0.10'
-- No package 'gstreamer-video-0.10' found
-- Checking for module 'gstreamer-app-0.10'
-- No package 'gstreamer-app-0.10' found
-- Checking for module 'gstreamer-riff-0.10'
-- No package 'gstreamer-riff-0.10' found
-- Checking for module 'gstreamer-pbutils-0.10'
-- No package 'gstreamer-pbutils-0.10' found
-- Checking for module 'libdc1394-2'
-- No package 'libdc1394-2' found
-- Checking for module 'libdc1394'
-- No package 'libdc1394' found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- Checking for module 'libavresample'
-- No package 'libavresample' found
-- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
-- Could NOT find Atlas (missing: Atlas_CLAPACK_INCLUDE_DIR)
-- A library with BLAS API found.
-- A library with LAPACK API found.
-- Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
-- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
-- OpenCV Python: during development append to PYTHONPATH: /mnt/ext2/opencv-4.0.0/build/python_loader
-- Excluding from source files list: modules/imgproc/src/corner.avx.cpp
-- Excluding from source files list: modules/imgproc/src/filter.avx2.cpp
-- Excluding from source files list: modules/imgproc/src/imgwarp.avx2.cpp
-- Excluding from source files list: modules/imgproc/src/imgwarp.sse4_1.cpp
-- Excluding from source files list: modules/imgproc/src/resize.avx2.cpp
-- Excluding from source files list: modules/imgproc/src/resize.sse4_1.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx2.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx512_skx.cpp
-- Excluding from source files list: modules/features2d/src/fast.avx2.cpp
-- Excluding from source files list: modules/calib3d/src/undistort.avx2.cpp
--
-- General configuration for OpenCV 4.0.0 =====================================
-- Version control: unknown
--
-- Platform:
-- Timestamp: 2019-04-14T12:06:42Z
-- Host: Linux 4.14.71-ti-r80 armv7l
-- CMake: 3.7.2
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/bin/make
-- Configuration: RELEASE
--
-- CPU/HW features:
-- Baseline: VFPV3 NEON
-- requested: DETECT
-- required: VFPV3 NEON
--
-- C/C++:
-- Built as dynamic libs?: YES
-- C++ Compiler: /usr/local/bin/c++ (ver 6.3.0)
-- C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfp16-format=ieee -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
-- C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfp16-format=ieee -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
-- C Compiler: /usr/local/bin/gcc
-- C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfp16-format=ieee -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
-- C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfp16-format=ieee -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release):
-- Linker flags (Debug):
-- ccache: NO
-- Precompiled headers: YES
-- Extra dependencies: dl m pthread rt
-- 3rdparty dependencies:
--
-- OpenCV modules:
-- To be built: calib3d core dnn features2d flann gapi highgui imgcodecs imgproc java_bindings_generator ml objdetect photo python3 python_bindings_generator stitching ts video videoio
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: java js python2
-- Applications: perf_tests apps
-- Documentation: NO
-- Non-free algorithms: NO
--
-- GUI:
-- GTK+: YES (ver 3.22.11)
-- GThread : YES (ver 2.50.3)
-- GtkGlExt: NO
-- VTK support: NO
--
-- Media I/O:
-- ZLib: /usr/lib/arm-linux-gnueabihf/libz.so (ver 1.2.8)
-- JPEG: /opt/libjpeg-turbo/lib32/libjpeg.a (ver 62)
-- WEBP: build (ver encoder: 0x020e)
-- PNG: /usr/lib/arm-linux-gnueabihf/libpng.so (ver 1.6.28)
-- TIFF: /usr/lib/arm-linux-gnueabihf/libtiff.so (ver 42 / 4.0.8)
-- JPEG 2000: build (ver 1.900.1)
-- OpenEXR: build (ver 1.7.1)
-- HDR: YES
-- SUNRASTER: YES
-- PXM: YES
-- PFM: YES
--
-- Video I/O:
-- DC1394: NO
-- FFMPEG: YES
-- avcodec: YES (ver 57.64.101)
-- avformat: YES (ver 57.56.101)
-- avutil: YES (ver 55.34.101)
-- swscale: YES (ver 4.2.100)
-- avresample: NO
-- GStreamer: NO
-- v4l/v4l2: linux/videodev2.h
--
-- Parallel framework: pthreads
--
-- Trace: YES (built-in)
--
-- Other third-party libraries:
-- Lapack: NO
-- Eigen: NO
-- Custom HAL: YES (carotene (ver 0.0.1))
-- Protobuf: build (3.5.1)
--
-- OpenCL: YES (no extra features)
-- Include path: /mnt/ext2/opencv-4.0.0/3rdparty/include/opencl/1.2
-- Link libraries: Dynamic load
--
-- Python 3:
-- Interpreter: /usr/bin/python3 (ver 3.5.3)
-- Libraries: /usr/lib/arm-linux-gnueabihf/libpython3.5m.so (ver 3.5.3)
-- numpy: /usr/lib/python3/dist-packages/numpy/core/include (ver 1.12.1)
-- packages path: lib/python3.5/dist-packages
--
-- Python (for build): /usr/bin/python2.7
--
-- Java:
-- ant: NO
-- JNI: NO
-- Java wrappers: NO
-- Java tests: NO
--
-- Install to: /usr/local
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
对我来说看起来不错。
编辑1
我现在已经尝试编译OpenCV 3.4.6。这给出了完全相同的错误。