Other Projects

Install OpenCV on Banana Pi[RP for BP]

4 9668
Post Last Edited by baoxian_zhang at 2014-5-15 03:14

I tried to install OpenCV on Banana Pi based on the mitch (http://mitchtech.net/raspberry-pi-opencv/), I took a whole day but happy at last.There are the steps:

1.Install the following packages:

  1. sudo apt-get -y install build-essential cmake cmake-qt-gui pkg-config libpng12-0 libpng12-dev libpng++-dev libpng3 libpnglite-dev zlib1g-dbg zlib1g zlib1g-dev pngtools libtiff4-dev libtiff4 libtiffxx0c2 libtiff-tools
  2. sudo apt-get -y install libjpeg8 libjpeg8-dev libjpeg8-dbg libjpeg-progs ffmpeg libavcodec-dev libavcodec53 libavformat53 libavformat-dev libgstreamer0.10-0-dbg libgstreamer0.10-0 libgstreamer0.10-dev libxine1-ffmpeg libxine-dev libxine1-bin libunicap2 libunicap2-dev libdc1394-22-dev libdc1394-22 libdc1394-utils swig libv4l-0 libv4l-dev python-numpy libpython2.6 python-dev python2.6-dev libgtk2.0-dev pkg-config
Copy the Code

maybe you will meet problems like this:
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
-bash: E:: command not found

Try to run
  1. sudo apt-get update
Copy the Code
,and install this packages in order.

2. Wget the source files of OpenCV

  1. wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.3.1/OpenCV-2.3.1a.tar.bz2
Copy the Code



3. Extract the archive and make a directory for the build
  1. tar -xvjpf OpenCV-2.3.1a.tar.bz2
  2. rm OpenCV-2.3.1a.tar.bz2
  3. cd OpenCV-2.3.1/
  4. mkdir build
  5. cd build
Copy the Code


4.To use the cmake GUI, run:
  1. cmake-gui ..
Copy the Code

1.png

Click "configure" and "Generate"

5.To compile, run make, then install with make install:
  1. make
  2. sudo make install
Copy the Code


2.png 3.png

It tooks me a very long time to finish compiling. 4 hours more or less.

6.Make some configurations for OpenCV
  1. sudo nano /etc/ld.so.conf.d/opencv.conf
Copy the Code


Add the following line at the end of the file and save it. In my case, the file was empty.
  1. /usr/local/lib
Copy the Code


7. Edit the bashrc file.
  1. sudo nano /etc/bash.bashrc
Copy the Code

Add the following new lies to the end of the file.
  1. PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig export PKG_CONFIG_PATH
Copy the Code


At last, the installation and configuration are end.


Test the OpenCV:
You can find some demos in build/bin.
QQ图片20140514195824.jpg

I also try the code on the OpenCV tutorial with gcc and cmake. The test steps are following.


  1. cd <DisplayImage_directory>
  2. cmake .
  3. make
Copy the Code




And at last the result
  1. ./DisplayImage lena.jpg
Copy the Code

4.png


The test source:
test.zip (90.38 KB, Downloads: 102)
it' s interesting. Nice job!

Hi !   when i run the test file,I have a problem :Xlib :extension RANDR missing on display ":10.0" ,and the picture can not be show.Can you help me!Thank you!

mbruck  
Thank you for post ...
I have compiled all without problems.  
What files I should copy from build/lib folder to usr/local/lib, since I got error when try to run "import cv2" from python?

Edited by michellejohn at Mar 22, 2019 05:12

It is a good detailed description. The codes are really helpful to find things real estate photography editing . And it is perfect help to understand and identify the task. The step by step description along with all possible problem that can occur make me do the update perfectly.       

You have to log in before you can reply Login | Sign Up

Points Rules