Raspberry Pi安装opencv

Raspberry Pi安装opencv

https://www.pyimagesearch.com/2016/04/18/install-guide-raspberry-pi-3-raspbian-jessie-opencv-3/

https://www.pyimagesearch.com/2015/02/23/install-opencv-and-python-on-your-raspberry-pi-2-and-b/

一些问题

1、Error in building opencv with ffmpeg

https://stackoverflow.com/questions/46884682/error-in-building-opencv-with-ffmpeg

2、OpenCV Linux 安装 Make出错

[  6%] Generating precomp.hpp.gch/opencv_core_Release.gch
In file included from /usr/include/c++/6/bits/stl_algo.h:59:0,
                 from /usr/include/c++/6/algorithm:62,
                 from /opt/opencv/opencv-3.1.0/modules/core/include/opencv2/core/base.hpp:53,
                 from /opt/opencv/opencv-3.1.0/modules/core/include/opencv2/core.hpp:54,
                 from /opt/opencv/opencv-3.1.0/modules/core/include/opencv2/core/utility.hpp:52,
                 from /opt/opencv/build/modules/core/precomp.hpp:49:
/usr/include/c++/6/cstdlib:75:25: fatal error: stdlib.h: 没有那个文件或目录
 #include_next 
                         ^
compilation terminated.
modules/core/CMakeFiles/pch_Generate_opencv_core.dir/build.make:62: recipe for target 'modules/core/precomp.hpp.gch/opencv_core_Release.gch' failed
make[2]: *** [modules/core/precomp.hpp.gch/opencv_core_Release.gch] Error 1
CMakeFiles/Makefile2:1178: recipe for target 'modules/core/CMakeFiles/pch_Generate_opencv_core.dir/all' failed
make[1]: *** [modules/core/CMakeFiles/pch_Generate_opencv_core.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2

gcc6已经吧stdlib.h纳入了libstdc++以进行更好的优化,C Library的头文件stdlib.h使用 Include_next,而include_next对gcc系统头文件路径很敏感。

推荐的修复方法是不要把include路径作为系统目录,而是使用标准方式包含include 目录

https://bugs.webkit.org/show_bug.cgi?id=161697

https://www.cnblogs.com/liutianchen/p/6089878.html

加入以下编译选项即可

-DENABLE_PRECOMPILED_HEADERS=OFF

3、Generator error: constant l_MAGIC_VAL (cname=cv::l::MAGIC_VAL) already exists

-- 
--   Python 2:
--     Interpreter:                 /home/pi/.virtualenvs/cv/bin/python2.7 (ver 2.7.16)
-- 
--   Python 3:
--     Interpreter:                 /home/pi/.virtualenvs/cv/bin/python3 (ver 3.7.3)
-- 
--   Python (for build):            /home/pi/.virtualenvs/cv/bin/python2.7
-- 
--   Java:

修改一下编译的选项:

cmake ../ -DENABLE_PRECOMPILED_HEADERS=OFF  -D BUILD_opencv_python3=OFF

你可能感兴趣的:(嵌入式平台,linux,opencv)