Alright so I have a hard-on for Computer Vision and Machine Learning, and I’m pumped to be getting into it. I’m going to document my experiences learning OpenCV here, and eventually start some cool projects. Please help me out, and provide some feedback!
Download
*NOTE: CMake is now the only method of building OpenCV SVN snapshots.*
*NOTE: Gijs Molenaar has now built OpenCV 2.1 packages for Ubuntu, bless his sweet little soul.*
$ sudo add-apt-repository ppa:gijzelaar/opencv2 $ sudo apt-get update $ sudo apt-get install opencv $ sudo apt-get install libopencv-dev $ sudo apt-get install python-opencv $ sudo apt-get install opencv-doc
Check here for more documentation on installing the Ubuntu packages Ubuntu Installation.
If you want to learn CMake, check my Getting Started with CMake tutorial.
There are a bunch of dependencies that I needed for reading and writing different image and movie formats. I got them all in one fell swoop.
$ sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg62-dev libtiff4-dev cmake libswscale-dev libjasper-dev
There was one of two things I could have done.
- Download the stable up to date version of OpenCV from Source Forge.
- Or my choice, get the cutting edge magic from Willow Garage’s SVN. (I’m so gonna work there one day…)
$ sudo apt-get install subversion $ cd ~/where/you/want/opencv/installed $ svn co https://code.ros.org/svn/opencv/trunk
Installation
So next I just hopped into the opencv folder that I downloaded and as stated above used CMake to build it
$ cd opencv $ cmake .
The ‘ . ‘ arguement sent into cmake told it to look for the CMakeLists.txt file in the current directory. This generated the Makefile for me, so the last step I did was to simply build it.
$ make
Next I had to configure the library, so I opened the config file with the following command
$ sudo vim /etc/ld.so.conf.d/opencv.conf
Since I installed it on Linux I had to add the following line to the bottom of the file, which was empty for me… Not a problem I guess.
/usr/local/lib
Then since I told it where to look for everything at and all the files had been built, I just configured it with the following command
$ sudo ldconfig
Lastly was a little icing on the cake, I put the extension of Intel’s performance primitives package (IPP) into my .bashrc file. I don’t have the optimization primitives by the way, I just thought it’d be nice to have this here in case I somehow become an OpenCV wizard and need them.
$ sudo vim /etc/bash.bashrc
Then add this at the very bottom of the file…
/PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig export PKG_CONFIG_PATH
HUZZAH! That’s that. Then I just reset my computer and got going on some OpenCV examples! Yay!
Now check the next section on image handling – 2. Basic Image Manipulation.
References
I’m studying from Gary Bradski’s Learning OpenCV
For those of you on windows, I wrote a quick guide for OpenCV setup on Windows. It includes some tips for using Eclipse as well.
Quite useful Tommy, I could afford to learn that myself. Thanks
Hey great! A neat step-by-step how to!
Hi,
I’m new to openCV.
I wanted to know if openCV algorithm could be implemented using Code Composer Studio v3.3.
I’ve already run my program using VC++ 6.0 its working fine.
But when i run the same program using CCS v3.3 it gives me following error during building process…
Linking..
>>error: library ‘C:\\Program Files\\OPenCV\\lib\\cxcore.lib’, member ‘cxcore100.dll’ is of unknown type
Has anyone compiled openCV using CCS and got same error?
Please let me know how to solve this problem
Thanks
Hey Jyo,
The error your getting looks to be some sort of a linking problem. However, I don’t program on Windows so I’m not very comfortable with dlls and how CCS links them to your program. Perhaps someone else has had more direct experience with your issue.
Best of luck,
Nathan
Hey Nathan,
Hope some1 gets back to me on solving this issue.
Thank You
Hi,
thanks for great tutorials on building, developing using opencv.
I followed all the steps of installing the package, downloading the openCV source , cmake, make,
At this step: sudo vim /etc/ld.so.conf.d/opencv.conf
my installation does not seem to have any file named opencv.conf
Any pointers what could be missing.
-AD.
Yo AD,
Things are a little bit different with OpenCV2.xx, I plan to rewrite this soon. I would suggest removing everything and installing from scratch using the following procedure.
cmake -D CMAKE_INSTALL_PREFIX=~/opencv-bin
You can replace ~/opencv-bin with what ever directory you’d like to install OpenCV into. Follow the cmake command with a
make install
Lastly just put the paths into your .bashrc file in case you want to link against the libraries with another program
export LD_LIBRARY_PATH=~/opencv-bin/lib:${LD_LIBRARY_PATH}
export PATH=~/opencv-bin/bin:$PATH
Let me know how this works out for you. It’s the testing phase for my next tutorial! Haha
Nathan
Has anyone used/compiled OpenCV under MS C# Express ?
Thanks…
To install OpenCV using the terminal on Ubuntu:
$ su -
# apt-get update
# apt-get install build-essential
# apt-get install libavformat-dev
# apt-get install x264 v4l-utils ffmpeg
# apt-get install libcv2.3 libcvaux2.3 libhighgui2.3 python-opencv opencv-doc libcv-dev libcvaux-dev libhighgui-dev
http://namhuy.net/1205/how-to-install-opencv-on-ubuntu.html