在树莓派b +上安装OpenCV 3.0


8

是否可以在Raspberry pi b +上安装OpenCV 3.0,opencv python?如何安装,是否有可用的预编译二进制文件?

Answers:


12

昨晚我刚刚在B版本上构建了3.0.0-beta版本。在B +中应该相同。

以下是我从源代码构建它的步骤(改编自:http : //robertcastle.com/2014/02/installing-opencv-on-a-raspberry-pi/)。希望能帮助到你。

确保您的系统是最新的。跑:

sudo apt-get更新
sudo apt-get升级
须藤rpi更新

下次安装所需的依赖项:

sudo apt-get install build-essential cmake cmake-curses-gui \
                               pkg-config libpng12-0 libpng12-dev libpng ++-dev \
                               libpng3 libpnglite-dev zlib1g-dbg zlib1g zlib1g-dev \
                               pngtools libtiff4-dev libtiff4 libtiffxx0c2 libtiff-tools libeigen3-dev
sudo apt-get install libjpeg8 libjpeg8-dev libjpeg8-dbg libjpeg-progs \
                               ffmpeg libavcodec-dev libavcodec53 libavformat53 \
                               libavformat-dev libxine1-ffmpeg libxine-dev libxine1-bin \
                               libunicap2 libunicap2-dev swig libv4l-0 libv4l-dev \
                               python-numpy libpython2.6 python-dev python2.6-dev libgtk2.0-dev

现在有趣的部分,转到目录以放置源并编译OpenCV。

cd / home / pi / builds /
git clone https://github.com/Itseez/opencv.git
cd opencv /
git checkout标签/3.0.0-beta
mkdir发布
cd发行/
ccmake ../

c开始配置过程。如果愿意,您可以切换一些选项,以下是我的最终选择。如果更改任何选项,请再次按c进行配置。现在按g生成Makefile。现在继续构建过程,请注意make命令将花费几个小时(在我的raspberry pi B模型上花费了7小时)。

使
须藤使安装
须藤ldconfig

以下是配置步骤中使用的选项设置:

 ANT_EXECUTABLE ANT_EXECUTABLE-NOTFOUND                                       
 BUILD_CUDA_STUBS关闭                                                           
 BUILD_DOCS开                                                            
 BUILD_EXAMPLES OFF                                                           
 BUILD_JASPER OFF                                                           
 BUILD_JPEG关闭                                                           
 BUILD_OPENEXR OFF                                                           
 BUILD_PACKAGE ON                                                            
 BUILD_PERF_TESTS开                                                            
 BUILD_PNG关闭                                                           
 BUILD_SHARED_LIBS开                                                            
 BUILD_TBB关闭                                                           
 BUILD_TESTS ON                                                            
 BUILD_TIFF OFF                                                           
 BUILD_WITH_DEBUG_INFO开                                                            
 BUILD_ZLIB关闭                                                           
 BUILD_opencv_apps开启                                                            
 BUILD_opencv_calib3d ON                                                            
 BUILD_opencv_core开启                                                            
 BUILD_opencv_features2d ON                                                            
 BUILD_opencv_flann开启                                                            
 BUILD_opencv_highgui开                                                            
 BUILD_opencv_imgcodecs开启                                                            
 BUILD_opencv_imgproc开启                                                            
 BUILD_opencv_ml ON                                                            
 BUILD_opencv_objdetect开                                                            
 BUILD_opencv_photo开                                                            
 BUILD_opencv_shape ON                                                            
 BUILD_opencv_stitching开启                                                            
 BUILD_opencv_superres ON                                                            
 BUILD_opencv_ts ON                                                            
 BUILD_opencv_video开                                                            
 BUILD_opencv_videoio开启                                                            
 BUILD_opencv_videostab开启                                                            
 BUILD_opencv_world关闭                                                           
 BZIP2_LIBRARIES /usr/lib/arm-linux-gnueabihf/libbz2.so                        
 CLAMDBLAS_INCLUDE_DIR CLAMDBLAS_INCLUDE_DIR-NOTFOUND                                
 CLAMDBLAS_ROOT_DIR CLAMDBLAS_ROOT_DIR-NOTFOUND                                   
 CLAMDFFT_INCLUDE_DIR CLAMDFFT_INCLUDE_DIR-NOTFOUND                                 
 CLAMDFFT_ROOT_DIR CLAMDFFT_ROOT_DIR-NOTFOUND                                    
 CMAKE_BUILD_TYPE                                                                               
 CMAKE_CONFIGURATION_TYPES调试;发布                                                 
 CMAKE_INSTALL_PREFIX / usr / local                                                    
 CUDA_BUILD_CUBIN已关闭                                                           
 CUDA_BUILD_EMULATION已关闭                                                           
 CUDA_HOST_COMPILER / usr / bin / gcc                                                  
 CUDA_SDK_ROOT_DIR CUDA_SDK_ROOT_DIR-NOTFOUND                                    
 CUDA_SEPARABLE_COMPILATION OFF                                                           
 CUDA_TOOLKIT_ROOT_DIR CUDA_TOOLKIT_ROOT_DIR-NOTFOUND                                
 CUDA_VERBOSE_BUILD关闭                                                           
 DOXYGEN_BUILD DOXYGEN_BUILD-NOTFOUND                                        
 EIGEN_INCLUDE_PATH / usr / include / eigen3                                           
 ENABLE_COVERAGE OFF                                                           
 ENABLE_IMPL_COLLECTION OFF                                                           
 ENABLE_NEON OFF                                                           
 ENABLE_NOISY_WARNINGS关闭                                                           
 启用ENABLE_OMIT_FRAME_POINTER                                                            
 启用ENABLE_PRECOMPILED_HEADERS                                                            
 ENABLE_PROFILING OFF                                                           
 ENABLE_SOLUTION_FOLDERS关闭                                                           
 ENABLE_VFPV3关闭                                                           
 EXECUTABLE_OUTPUT_PATH / home / pi / builds / opencv / release / bin                            
 GIGEAPI_INCLUDE_PATH GIGEAPI_INCLUDE_PATH-NOTFOUND                                 
 GIGEAPI_LIBRARIES GIGEAPI_LIBRARIES-NOTFOUND                                    
 INSTALL_CREATE_DISTRIB关闭                                                           
 关闭INSTALL_C_EXAMPLES                                                           
 关闭INSTALL_PYTHON_EXAMPLES                                                           
 INSTALL_TESTS OFF                                                           
 关闭INSTALL_TO_MANGLED_PATHS                                                           
 OPENCV_CONFIG_FILE_INCLUDE_DIR / home / pi / builds / opencv / release                                
 OPENCV_EXTRA_MODULES_PATH                                                                      
 OPENCV_WARNINGS_ARE_ERRORS关闭                                                           
 OPENEXR_INCLUDE_PATH / usr / include / OpenEXR                                          
 PLANTUML PLANTUML-NOTFOUND                                             
 PVAPI_INCLUDE_PATH PVAPI_INCLUDE_PATH-NOTFOUND                                   
 PYTHON2_EXECUTABLE /usr/bin/python2.7                                            
 PYTHON2_INCLUDE_DIR                                                                            
 PYTHON2_INCLUDE_DIR2                                                                           
 PYTHON2_LIBRARY                                                                                
 PYTHON2_LIBRARY_DEBUG                                                                          
 PYTHON2_NUMPY_INCLUDE_DIRS /usr/lib/pymodules/python2.7/numpy/core/include               
 PYTHON2_PACKAGES_PATH lib / python2.7 / dist-packages                                   
 PYTHON3_EXECUTABLE / usr / bin / python3                                              
 PYTHON3_INCLUDE_DIR                                                                            
 PYTHON3_INCLUDE_DIR2                                                                           
 PYTHON3_LIBRARY                                                                                
 PYTHON3_LIBRARY_DEBUG                                                                          
 PYTHON3_NUMPY_INCLUDE_DIRS / usr / lib / python3 / dist-packages / numpy / core / include             
 PYTHON3_PACKAGES_PATH lib / python3.2 / dist-packages                                   
 SPHINX_BUILD SPHINX_BUILD-NOTFOUND                                         
 VTK_DIR VTK_DIR-NOTFOUND                                              
 WEBP_INCLUDE_DIR WEBP_INCLUDE_DIR-NOTFOUND                                     
 WITH_1394开                                                            
 WITH_CLP OFF                                                           
 WITH_CUBLAS OFF                                                           
 WITH_CUDA开                                                            
 WITH_CUFFT开启                                                            
 WITH_EIGEN ON                                                            
 WITH_FFMPEG ON                                                            
 WITH_GDAL OFF                                                           
 WITH_GIGEAPI开启                                                            
 WITH_GSTREAMER开启                                                            
 WITH_GSTREAMER_0_10 OFF                                                           
 WITH_GTK开启                                                            
 WITH_GTK_2_X OFF                                                           
 WITH_JASPER ON                                                            
 WITH_JPEG开                                                            
 WITH_LIBV4L ON                                                            
 WITH_NVCUVID OFF                                                           
 WITH_OPENCL开启                                                            
 WITH_OPENCLAMDBLAS ON                                                            
 WITH_OPENCLAMDFFT ON                                                            
 WITH_OPENEXR ON                                                            
 WITH_OPENGL ON                                                            
 WITH_OPENMP OFF                                                           
 WITH_OPENNI OFF                                                           
 WITH_OPENNI2 OFF                                                           
 WITH_PNG开启                                                            
 WITH_PVAPI开启                                                            
 WITH_QT OFF                                                           
 WITH_TBB已关闭                                                           
 WITH_TIFF ON                                                            
 WITH_UNICAP OFF                                                           
 WITH_V4L开启                                                            
 WITH_VTK开启                                                            
 WITH_WEBP开                                                            
 WITH_XIMEA OFF                                                           
 WITH_XINE OFF                                                           

您能共享cv2.so吗,我无法安装opencv,我也不知道为什么

不幸的是,我已经卸载了版本3。我想将其与GStreamer一起使用,但是GStreamer尚不支持v3。抱歉:\
Miguel Domingues

10

根据Miguel的答案进行编译时,请使用

    >> make -j4

在树莓派2-B / B-2模型上,由于使用了所有内核,这可能会大大加快编译速度。

注意:如果使用此选项编译时出现错误,请使用

make

要解决这个问题。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.