Como instalar o opencv no Ubuntu 12.04 e executá-lo com o Python?

1

Eu gostaria de fazer processamento de imagens no raspberry-pi.

Para isso, primeiro quero fazer no Ubuntu.

Quando eu executo o comando sudo apt-get install libopencv-dev . Eu tenho a seguinte saída:

naveen@ubuntu:~$ sudo apt-get install libopencv-dev

[sudo] password for naveen: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
 gir1.2-ubuntuoneui-3.0 firefox-locale-en language-pack-kde-en cabextract
 kde-l10n-engb libjpeg62 libubuntuoneui-3.0-1 thunderbird-globalmenu
 language-pack-en-base language-pack-kde-en-base language-pack-en
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
 debhelper dh-apparmor gettext html2text intltool-debian libatk1.0-dev
 libavcodec-dev libavformat-dev libavutil-dev libcairo-script-interpreter2
 libcairo2-dev libdc1394-22-dev libexpat1-dev libfontconfig1-dev
 libfreetype6-dev libgdk-pixbuf2.0-dev libgettextpo0 libglib2.0-dev
 libgtk2.0-dev libice-dev libilmbase-dev libmail-sendmail-perl
 libopencv-calib3d-dev libopencv-calib3d2.3 libopencv-contrib-dev
 libopencv-contrib2.3 libopencv-core-dev libopencv-core2.3
 libopencv-features2d-dev libopencv-features2d2.3 libopencv-flann-dev
 libopencv-flann2.3 libopencv-gpu-dev libopencv-gpu2.3 libopencv-highgui-dev
 libopencv-highgui2.3 libopencv-imgproc-dev libopencv-imgproc2.3
 libopencv-legacy-dev libopencv-legacy2.3 libopencv-ml-dev libopencv-ml2.3
 libopencv-objdetect-dev libopencv-objdetect2.3 libopencv-video-dev
 libopencv-video2.3 libopenexr-dev libpango1.0-dev libpcre3-dev libpcrecpp0
 libpixman-1-dev libpng12-dev libpthread-stubs0 libpthread-stubs0-dev
 libraw1394-dev libsm-dev libswscale-dev libsys-hostname-long-perl
 libunistring0 libx11-dev libx11-doc libxau-dev libxcb-render0-dev
 libxcb-shm0-dev libxcb1-dev libxcomposite-dev libxcursor-dev libxdamage-dev
 libxdmcp-dev libxext-dev libxfixes-dev libxft-dev libxi-dev libxinerama-dev
 libxrandr-dev libxrender-dev po-debconf x11proto-composite-dev
 x11proto-core-dev x11proto-damage-dev x11proto-fixes-dev x11proto-input-dev
 x11proto-kb-dev x11proto-randr-dev x11proto-render-dev x11proto-xext-dev
 x11proto-xinerama-dev xorg-sgml-doctools xtrans-dev
 Suggested packages:
  dh-make gettext-doc libfaad-dev libgsm1-dev libogg-dev libschroedinger-dev
  libspeex-dev libtheora-dev libvorbis-dev libcairo2-doc libglib2.0-doc
  libgtk2.0-doc libpango1.0-doc libraw1394-doc libxcb-doc libmail-box-perl
 Recommended packages:
   libraw1394-tools
 The following NEW packages will be installed:
   debhelper dh-apparmor gettext html2text intltool-debian libatk1.0-dev
   libavcodec-dev libavformat-dev libavutil-dev libcairo-script-interpreter2
   libcairo2-dev libdc1394-22-dev libexpat1-dev libfontconfig1-dev
   libfreetype6-dev libgdk-pixbuf2.0-dev libgettextpo0 libglib2.0-dev
   libgtk2.0-dev libice-dev libilmbase-dev libmail-sendmail-perl
   libopencv-calib3d-dev libopencv-calib3d2.3 libopencv-contrib-dev
   libopencv-contrib2.3 libopencv-core-dev libopencv-core2.3 libopencv-dev
   libopencv-features2d-dev libopencv-features2d2.3 libopencv-flann-dev
   libopencv-flann2.3 libopencv-gpu-dev libopencv-gpu2.3 libopencv-highgui-dev
   libopencv-highgui2.3 libopencv-imgproc-dev libopencv-imgproc2.3
   libopencv-legacy-dev libopencv-legacy2.3 libopencv-ml-dev libopencv-ml2.3
   libopencv-objdetect-dev libopencv-objdetect2.3 libopencv-video-dev
   libopencv-video2.3 libopenexr-dev libpango1.0-dev libpcre3-dev libpcrecpp0
   libpixman-1-dev libpng12-dev libpthread-stubs0 libpthread-stubs0-dev
   libraw1394-dev libsm-dev libswscale-dev libsys-hostname-long-perl
   libunistring0 libx11-dev libx11-doc libxau-dev libxcb-render0-dev
   libxcb-shm0-dev libxcb1-dev libxcomposite-dev libxcursor-dev libxdamage-dev
   libxdmcp-dev libxext-dev libxfixes-dev libxft-dev libxi-dev libxinerama-dev
   libxrandr-dev libxrender-dev po-debconf x11proto-composite-dev
   x11proto-core-dev x11proto-damage-dev x11proto-fixes-dev x11proto-input-dev
   x11proto-kb-dev x11proto-randr-dev x11proto-render-dev x11proto-xext-dev
   x11proto-xinerama-dev xorg-sgml-doctools xtrans-dev
   0 upgraded, 90 newly installed, 0 to remove and 0 not upgraded.
   Need to get 300 kB/32.4 MB of archives.
   After this operation, 135 MB of additional disk space will be used.
 Do you want to continue [Y/n]? y
   Err http://archive.ubuntu.com/ubuntu/ precise-updates/main x11proto-core-dev all 7.0.22-1ubuntu0.1
   Connection failed [IP: 91.189.91.13 80]
   Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/x/x11proto-core/x11proto-core-dev_7.0.22-1ubuntu0.1_all.deb  Connection failed [IP: 91.189.91.13 80]
   E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Existe algo que eu possa fazer para resolver o erro?

    
por Naveen Kumar 21.12.2013 / 14:07

1 resposta

0

Muitas pessoas têm problemas com a instalação do OpenCV. Existe um simples arquivo de script .sh para obter todos os arquivos de dependências da Internet e compilar a fonte e finalmente instalar o opencv em seu sistema.

Faça o download do ultimo opencv.sh de aqui

Eu assumo como você me disse que baixou o script no diretório de download e faça o seguinte:

Abra o terminal.

cd ~/Downloads  
chmod +x opencv.sh
./opencv.sh

Veja a documentação do Ubuntu para mais informações

    
por Maythux 21.12.2013 / 14:15