• phone-1
  • phone-2
  • logoweblarge640_480

Instalar OpenCV en MAC (Maverick)

El procedimiento para instalar OpenCV para python3 en MAC 10.9.5  es el siguiente:

Se requiere previamente tener instalado python 3

Normalmente si no se cuenta con Python3 instalado en  MAC lo más fácil es:

brew install python3
pip3 install numpy

INSTALANDO OPENCV EN PYTHON3 USANDO CMAKE POR CONSOLA

  • Primero descargamos la versión  requerida :
    wget https://github.com/Itseez/opencv/archive/3.0.0-rc1.zip
  • Descomprimimos el archivo
    unzip opencv-3.0.0-rc1.zip
  • Entramos al folder
    cd   opencv-3.0.0-rc1
  • Creamos el directorio “build”
    mkdir build
  • Ingresamos al directorio
    cd build
  • Procedemos con la configuración y compilación del proyecto con los siguientes 3 pasos:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D PYTHON_EXECUTABLE=/Library/Frameworks/Python.framework/Versions/3.4/bin/python3 -D PYTHON_LIBRARY=/Library/Frameworks/Python.framework/Versions/3.4/lib/libpython3.4m.dylib -D PYTHON_INCLUDE_DIR=/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -D PYTHON_NUMPY_INCLUDE_DIRS=/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/numpy/core/include/numpy -D PYTHON_PACKAGES_PATH=/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages ..

 

make -j8

sudo make install

Debemos agregar a nuestro archivo ~/.bash_profile  la variable de entorno PYTHONPATH :

PYTHONPATH=”${PYTHONPATH}:/usr/local/lib/python3.4/site-packages”
export PYTHONPATH

 

Para visualizar todas las variables de entorno en la terminal de MAC digitamos “env” y damos enter.

Para probar si OpenCV  se instalo correctamente en la terminal de MAC digitamos:

“python3″

y posteriormente

“import cv2″

Si no se genera ningún mensaje de error esto quiere decir que todo funciono perfectamente

Si quisieramos eliminar la variable de entorno digitamos

unset PYTHONPATH

Si se necesita desinstalar OpenCV y estando dentro del folder build ejecutamos:

sudo make uninstall

Espero que los anteriores pasos hayan sido de ayuda.

  • Hannah - 9 years ago

    One woman raised her hand when she felt full and was led into an MRI machine, where her totally packed stomach was easily seen on the screen. Then, the moment of truth: she looked at a big piece of cake.

    • Morgan - 9 years ago

      Two women volunteers got into their hospital pajamas and ate a several-course French chef cooked meal brought in specially for the purpose.

  • Sam - 9 years ago

    A tough job, no doubt, but someone had to do it – as the narrator so wisely explained, “We can only find out if we have special room for dessert if we’re full.”