include nonfree openCV 2.4.10 on ubuntu

sudo add-apt-repository --yes ppa:xqms/opencv-nonfree
sudo apt-get update
sudo apt-get install libopencv-nonfree-dev

---this answer works well for me, thanks @Maystro

after this step, just link your program to -lopencv_nonfree, or you cannot access to surf.


Actually, I just updated openCV using the following commands then it worked:

sudo add-apt-repository --yes ppa:xqms/opencv-nonfree
sudo apt-get update 
sudo apt-get install libopencv-nonfree-dev