Instalar OpenCV 3.0 en raspberry pi b +

8

¿Es posible instalar OpenCV 3.0, opencv python en Raspberry pi b +? ¿Cómo instalar y hay binarios precompilados disponibles?

parthi82
fuente

Respuestas:

12

Anoche acabo de construir la versión 3.0.0-beta en la versión B. Debería ser lo mismo en un B +.

A continuación se detallan los pasos que he realizado para compilarlo desde la fuente (adaptado de: http://robertcastle.com/2014/02/installing-opencv-on-a-raspberry-pi/ ). Espero eso ayude.

Asegúrese de que su sistema esté actualizado. Correr:

sudo apt-get update
sudo apt-get upgrade
sudo rpi-update

Siguiente instalación dependencias requeridas:

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

Ahora la parte interesante, cambie a un directorio para colocar las fuentes y compilar OpenCV.

cd / home / pi / builds /
git clone https://github.com/Itseez/opencv.git
cd opencv /
Etiquetas de pago git / 3.0.0-beta
lanzamiento de mkdir
lanzamiento de cd /
ccmake ../

Presione c para iniciar el proceso de configuración. Puede alternar algunas opciones si lo desea, mis opciones finales están a continuación. Si cambia alguna opción, presione c nuevamente para configurar. Ahora presione g para generar el Makefile. Ahora continúe con el proceso de compilación, observe que el comando make tardará varias horas (tardó 7h en mi modelo raspberry pi B).

hacer
sudo make install
sudo ldconfig

Estas son las opciones de configuración utilizadas en el paso de configuración:

 ANT_EXECUTABLE ANT_EXECUTABLE-NOTFOUND                                       
 BUILD_CUDA_STUBS OFF                                                           
 BUILD_DOCS ON                                                            
 BUILD_EXAMPLES OFF                                                           
 BUILD_JASPER OFF                                                           
 BUILD_JPEG OFF                                                           
 BUILD_OPENEXR OFF                                                           
 BUILD_PACKAGE ON                                                            
 BUILD_PERF_TESTS ON                                                            
 BUILD_PNG OFF                                                           
 BUILD_SHARED_LIBS ON                                                            
 BUILD_TBB OFF                                                           
 BUILD_TESTS ON                                                            
 BUILD_TIFF OFF                                                           
 BUILD_WITH_DEBUG_INFO ON                                                            
 BUILD_ZLIB OFF                                                           
 BUILD_opencv_apps ON                                                            
 BUILD_opencv_calib3d ON                                                            
 BUILD_opencv_core ON                                                            
 BUILD_opencv_features2d ON                                                            
 BUILD_opencv_flann ON                                                            
 BUILD_opencv_highgui ON                                                            
 BUILD_opencv_imgcodecs ON                                                            
 BUILD_opencv_imgproc ON                                                            
 BUILD_opencv_ml ON                                                            
 BUILD_opencv_objdetect ON                                                            
 BUILD_opencv_photo ON                                                            
 BUILD_opencv_shape ON                                                            
 BUILD_opencv_stitching ON                                                            
 BUILD_opencv_superres ON                                                            
 BUILD_opencv_ts ON                                                            
 BUILD_opencv_video ON                                                            
 BUILD_opencv_videoio ON                                                            
 BUILD_opencv_videostab ON                                                            
 BUILD_opencv_world OFF                                                           
 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 Debug; Release                                                 
 CMAKE_INSTALL_PREFIX / usr / local                                                    
 CUDA_BUILD_CUBIN OFF                                                           
 CUDA_BUILD_EMULATION OFF                                                           
 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 OFF                                                           
 DOXYGEN_BUILD DOXYGEN_BUILD-NOTFOUND                                        
 EIGEN_INCLUDE_PATH / usr / include / eigen3                                           
 ENABLE_COVERAGE OFF                                                           
 ENABLE_IMPL_COLLECTION OFF                                                           
 ENABLE_NEON OFF                                                           
 ENABLE_NOISY_WARNINGS OFF                                                           
 ENABLE_OMIT_FRAME_POINTER ON                                                            
 ENABLE_PRECOMPILED_HEADERS ON                                                            
 ENABLE_PROFILING OFF                                                           
 ENABLE_SOLUTION_FOLDERS OFF                                                           
 ENABLE_VFPV3 OFF                                                           
 EXECUTABLE_OUTPUT_PATH / home / pi / builds / opencv / release / bin                            
 GIGEAPI_INCLUDE_PATH GIGEAPI_INCLUDE_PATH-NOTFOUND                                 
 GIGEAPI_LIBRARIES GIGEAPI_LIBRARIES-NOTFOUND                                    
 INSTALL_CREATE_DISTRIB OFF                                                           
 INSTALL_C_EXAMPLES OFF                                                           
 INSTALL_PYTHON_EXAMPLES OFF                                                           
 INSTALL_TESTS OFF                                                           
 INSTALL_TO_MANGLED_PATHS OFF                                                           
 OPENCV_CONFIG_FILE_INCLUDE_DIR / home / pi / builds / opencv / release                                
 OPENCV_EXTRA_MODULES_PATH                                                                      
 OPENCV_WARNINGS_ARE_ERRORS OFF                                                           
 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 ENCENDIDO                                                            
 WITH_CLP OFF                                                           
 WITH_CUBLAS OFF                                                           
 WITH_CUDA ON                                                            
 WITH_CUFFT ON                                                            
 WITH_EIGEN ON                                                            
 WITH_FFMPEG ON                                                            
 WITH_GDAL OFF                                                           
 WITH_GIGEAPI ON                                                            
 WITH_GSTREAMER ON                                                            
 WITH_GSTREAMER_0_10 OFF                                                           
 WITH_GTK ON                                                            
 WITH_GTK_2_X OFF                                                           
 WITH_JASPER ON                                                            
 WITH_JPEG ON                                                            
 WITH_LIBV4L ON                                                            
 WITH_NVCUVID OFF                                                           
 WITH_OPENCL ON                                                            
 WITH_OPENCLAMDBLAS ON                                                            
 WITH_OPENCLAMDFFT ON                                                            
 WITH_OPENEXR ON                                                            
 WITH_OPENGL ON                                                            
 WITH_OPENMP OFF                                                           
 WITH_OPENNI OFF                                                           
 WITH_OPENNI2 OFF                                                           
 WITH_PNG ON                                                            
 WITH_PVAPI ON                                                            
 WITH_QT OFF                                                           
 WITH_TBB OFF                                                           
 WITH_TIFF ON                                                            
 WITH_UNICAP OFF                                                           
 CON_V4L ENCENDIDO                                                            
 WITH_VTK ON                                                            
 WITH_WEBP ON                                                            
 WITH_XIMEA OFF                                                           
 WITH_XINE OFF                                                           
Miguel Domingues
fuente
¿Puede compartir la cv2.so no pude instalar OpenCV y yo no sé por qué
Desafortunadamente, desinstalé la versión 3. Quería usarla junto con GStreamer, pero GStreamer aún no es compatible con v3. Lo sentimos: \
Miguel Domingues
10

Al compilar según la respuesta de Miguel, hágalo con un

    >> make -j4

En el modelo raspberry pi 2-B / B-2, esto puede acelerar la compilación significativamente ya que se utilizan todos los núcleos.

NOTA: Si obtiene un error al compilar con esta opción, simplemente use

make

arreglarlo.

luboP
fuente