Friday, November 8, 2013

OpenCV

I am back again. Don't know how long I will stay. But, I want to try something with opencv. Eventually this will happen in ARM platform. However, I am starting with my old laptop running ubuntu.

Step-1: Compiling opencv
  1. Download opencv from http://opencv.org/downloads.html
  2. Create a folder where you are going to build this and untar the files there (I did it in /host/opencv. This created opencv-2.4.6.1 folder inside above directory)
  3. For detailed installation steps, you can visit http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html
  4. I did not have cmake installed. Installed it using command "sudo apt-get install cmake""
  5. I also ran "sudo apt-get update", "sudo apt-get install libgtk2.0-dev" and "sudo apt-get install ffmpeg"
  6. Created 2 folder scripts and release
    1. /host/opencv/scripts -> A folder for my build script
    2. /host/opencv/release -> A folder for saving my release binaries
  7. Created my build.sh in scripts folder. It is pasted below
BUILD_DIR=$PWD/../release/
SRC_DIR=$PWD/../opencv-2.4.6.1/
cd ${BUILD_DIR}
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ${SRC_DIR}
make -j 6
Once you do the above steps, run build.sh and then once the build is successfully completed, enter the release folder and execute "sudo make install".
This will install your  built binaries to /usr/local. This is only building OpenCV. I will talk about building a program using this in another post.
  1.