Saturday, August 6, 2011

Instalando OpenCV 2.3 no Ubuntu 10.10

Ubuntu 10.10
OpenCV 2.3
Python 2.6.5


Status:
  • Instalando
ToDo:
  • Compilar? e testar exemplos em python-CV2
Install:
  • sudo apt-get install build-essential pkg-config libavcodec-dev libavformat-dev libjpeg62-dev libtiff4-dev cmake libswscale-dev libjasper-dev python-opencv libgtk2.0-dev
  • cd /opt
  • sudo wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.3/OpenCV-2.3.0.tar.bz2
  • sudo tar xvf OpenCV-2.3.0.tar.bz2
  • cd OpenCV-2.3.0
  • sudo cmake -D BUILD_PYTHON_SUPPORT=ON . (verifique se FFMPEG = 1)
  • sudo make (zzz.)
  • sudo make install
  • ???sudo mv /usr/local/lib/python2.6/site-packages/cv.so /usr/local/lib/python2.6/dist-packages/cv.so???
  • sudo nano /etc/ld.so.conf.d/opencv.conf (new file with this content: /usr/local/lib)
  • sudo ldconfig
  • sudo gedit /etc/bash.bashrc
  • Acrescente no final do arquivo o conteúdo das duas linhas abaixo:
  • PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
  • export PKG_CONFIG_PATH

Compilando exemplos em C:
  • cd /opt/OpenCV-2.3.0/samples/c
  • sudo chmod +x build_all.sh
  • sudo ./build_all.sh
Testando exemplos em C:
  • cd /opt/OpenCV-2.3.0/samples/c
  • ./facedetect --cascade="/usr/local/share/opencv/haarcascades/haarcascade_frontalface_alt.xml" --scale=1.5 lena.jpg
  • ./facedetect --cascade="/usr/local/share/opencv/haarcascades/haarcascade_frontalface_alt.xml" --scale=1.5
Testando exemplos em Python:
  • synaptic (python-opencv python-dev)
  • cd /opt/OpenCV-2.3.0/samples/python
  • copiar pasta "OpenCV"/data para "OpenCV"/samples
  • ./facedetect.py 0
  • ./motempl.py (contorno e movimento)
  • ./laplace.py (contorno)
Info: