当 Ubuntu 16.10 显示缺少 sys/videoio.h 时,我该如何安装 OpenCV 3.2.0?

当 Ubuntu 16.10 显示缺少 sys/videoio.h 时,我该如何安装 OpenCV 3.2.0?

我正在关注这个教程http://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/安装 OpenCV。我正在尝试在 Ubuntu 16.10 上安装 OpenCV 3.2.0。

当我进入后

$ cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D INSTALL_C_EXAMPLES=OFF \
    -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.1.0/modules \
    -D PYTHON_EXECUTABLE=~/.virtualenvs/cv/bin/python \
    -D BUILD_EXAMPLES=ON ..

我收到以下错误:

Run Build Command:"/usr/bin/make" "cmTC_1451c/fast"
/usr/bin/make -f CMakeFiles/cmTC_1451c.dir/build.make CMakeFiles/cmTC_1451c.dir/build
make[1]: Entering directory '/home/soubriquet/3rdparty/opencv-3.2.0/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_1451c.dir/CheckIncludeFile.c.o
/usr/bin/cc    -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 -Wno-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden  -O3 -DNDEBUG   -o CMakeFiles/cmTC_1451c.dir/CheckIncludeFile.c.o   -c /home/soubriquet/3rdparty/opencv-3.2.0/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
/home/soubriquet/3rdparty/opencv-3.2.0/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:25: fatal error: sys/videoio.h: No such file or directory
 #include <sys/videoio.h>
                         ^
compilation terminated.
CMakeFiles/cmTC_1451c.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_1451c.dir/CheckIncludeFile.c.o' failed
make[1]: *** [CMakeFiles/cmTC_1451c.dir/CheckIncludeFile.c.o] Error 1
make[1]: Leaving directory '/home/soubriquet/3rdparty/opencv-3.2.0/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_1451c/fast' failed
make: *** [cmTC_1451c/fast] Error 2

似乎很多人都遇到了这个问题,但一直无法解决。有人有什么想法吗?

相关内容