Install OpenCV on Ubuntu Linux

This article is old. Please visit my new article revised: Install OpenCV on Ubuntu or Debian.

90 comments:

  1. Hi,

    Thanks for the tutorial..It was just what i needed to get Opencv installed.

    Great Job!!!

    Cheers

    ReplyDelete
  2. it took me a while, but got it running at last, you blog has help me a lot, Thank you

    ReplyDelete
  3. Nice article. Precise & Lucid !
    Great Work.
    Thanks.

    ReplyDelete
  4. Great!
    this is the best tutorial I ever seen about OpenCV.
    Thanks

    ReplyDelete
  5. at last getting error ... like
    https://www.dropbox.com/s/1yv0x60xz776qu7/Screenshot%20from%202013-09-12%2000%3A59%3A11.png

    ReplyDelete
    Replies
    1. It is because you don't apply correctly the step 5: Configure OpenCV.

      Delete
  6. Very good one...Thanks :-)

    ReplyDelete
  7. Hello, I am having problem with hough transform . can u help? it is giving some error

    ReplyDelete
  8. Hello, very nice manual
    However, in the example part, after ./build_all.sh I get this output

    g++: error: tbb: No such file or directory
    g++: error: rt: No such file or directory
    g++: error: pthread: No such file or directory
    g++: error: m: No such file or directory
    g++: error: dl: No such file or directory

    Can you please inform me about this error?

    ReplyDelete
    Replies
    1. Hi,Have you solved that error ?,I meet the same problem, can you tell me how to do with it?

      Delete
    2. Hi I've solved this problem by doing this
      First locate opencv.pc file, its usually in /usr/lib/../pkg-config/opencv.pc
      goto last but one line and it should be like this

      tbb rt pthread m dl

      Need to change this like below

      -ltbb -lrt -lpthread -lm -ldl

      Now try compiling it should work fine
      got this solution from some question in stackoverflow

      Delete
  9. I am getting the error of which Anonymous is getting up there ^ ?? Thanks in advance.

    ReplyDelete
    Replies
    1. Hi

      You guys should download opencv again, and make sure you compile with in the opencv directory i.e step 4

      Delete
  10. thank you!!! literally spent months trying to get it to work

    ReplyDelete
  11. hi all ,
    my name is hagai,
    I have run this steps ./facedetect lena.jpg
    i got this massage


    Illegal instruction (core dumped)
    can anyone help?

    ReplyDelete
  12. Thanks for this! saved me some time!

    ReplyDelete
  13. Thanks man... one of the best and easy way to install...i have some doubts related to the subject. Is there any blog of yours related to the opencv and opencv related programs.If it is there can you tell?

    ReplyDelete
  14. do we need any prerequisites before starting with the first step?
    coz wen i tried the step 2 it showed no such entry
    please help me

    ReplyDelete
  15. Thank you so much!!!!!

    ReplyDelete
  16. After I try to execute step 2 (installing the dependencies), I get the following error:

    Package 'libtbb-dev' has no installation candidate
    Unable to locate package libfaac-dev

    Are there some other dependencies that I need to install beforehand? Is the order of the dependencies incorrect?

    ReplyDelete
  17. thank you! works perfectly! saved me a lot of time!

    ReplyDelete
  18. Hi, I am having a problem when it comes to step 4 when i execute the command 'make'

    it gives me this error

    Linking CXX executable ../../bin/opencv_perf_gpu
    /usr/bin/ld: ../../lib/libopencv_highgui.so.2.4.3: don't know how to handle section ` ' [0x 2372]
    ../../lib/libopencv_highgui.so.2.4.3: could not read symbols: File in wrong format
    collect2: ld returned 1 exit status
    make[2]: *** [bin/opencv_perf_gpu] Error 1
    make[1]: *** [modules/gpu/CMakeFiles/opencv_perf_gpu.dor/all] Error 2
    make:: *** [all] Error 2

    i hope that you can help me resolve this problem as I need to rush with the completion of my project and opencv is a very important aspect of it, thanks so much for ur reply

    ReplyDelete
  19. can this be the same for raspbian on raspberry pi too? thanks

    ReplyDelete
  20. while running samples/c file I m getting fatal error of file not found or directory not found can some one solve this problem

    ReplyDelete
  21. Thanks a bunch! I've been trying to install OpenCV on Win8 for the past four months but with no success. Now I'm on Ubuntu 13.10 and this really worked for me!

    ReplyDelete
  22. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. Thanks, I am also installed Opencv 2.4.8 in Ubuntu 13.10 Its worked......

      Delete
  23. THANK YOU VERY MUCH

    ReplyDelete
  24. Superb blog....Follow every word as it is and your are done

    ReplyDelete
  25. Thank you so much for your tutorial. This helped me a lot. perfect blog for openCV beginners.

    ReplyDelete
  26. help! I have this message error before passage 5:
    CMake Error at CMakeLists.txt:62 (include):
    include could not find load file:

    cmake/OpenCVUtils.cmake


    CMake Error at CMakeLists.txt:64 (ocv_clear_vars):
    Unknown CMake command "ocv_clear_vars".


    -- Configuring incomplete, errors occurred!
    what can I do?

    ReplyDelete
  27. When i try and run step 5, i get a permission denied error. any ideas?

    ReplyDelete
    Replies
    1. you need to enter sudo before the command, and it will work.

      Delete
  28. TY for this tutorial, simple, precise and helpful !

    ReplyDelete
  29. Hi, can I delete opencv folder after these steps?
    I'm using opencv with java, and cmake created both build/bin/opencv-249.jar and build/lib/libopencv_java249.so , but make didn't installed them in usr/local/... , or at least I coulnd't find them.
    I don't know where to copy theese files, nor if I have to copy more files in order to safe delete originally decompressed opencv directory.
    Thank you very much.

    ReplyDelete
  30. Great article, better than the official one that's for sure.

    Cheers

    ReplyDelete
  31. It worked thank u so much.......................... Great........

    ReplyDelete
  32. after i install openCV,can i use IDE such as Eclipse?

    ReplyDelete
    Replies
    1. Yes you can, I use Eclipse CDT (C++ IDE). If you have eclipse you can add cdt plugin, or you can download Eclipse with CDT. Here are some tutorials
      http://docs.opencv.org/2.4.9/doc/tutorials/introduction/table_of_content_introduction/table_of_content_introduction.html#table-of-content-introduction

      Delete
  33. sir i want to create a app that uses opencv to play virtual piano through gesture can u help me to do it plz ....sir

    ReplyDelete
  34. Am I missing something? Im getting the following


    [ 70%] Building CXX object modules/nonfree/CMakeFiles/opencv_perf_nonfree.dir/perf/perf_main.cpp.o
    In file included from /home/sello/opencv-2.4.9/modules/nonfree/perf/perf_main.cpp:28:0:
    /home/sello/opencv-2.4.9/modules/ocl/include/opencv2/ocl/private/opencl_dumpinfo.hpp: In function ‘void dumpOpenCLDevice()’:
    /home/sello/opencv-2.4.9/modules/ocl/include/opencv2/ocl/private/opencl_dumpinfo.hpp:88:9: error: ‘PlatformsInfo’ is not a member of ‘cv::ocl’
    /home/sello/opencv-2.4.9/modules/ocl/include/opencv2/ocl/private/opencl_dumpinfo.hpp:88:32: error: expected ‘;’ before ‘platforms’
    /home/sello/opencv-2.4.9/modules/ocl/include/opencv2/ocl/private/opencl_dumpinfo.hpp:89:9: error: ‘getOpenCLPlatforms’ is not a member of ‘cv::ocl’
    /home/sello/opencv-2.4.9/modules/ocl/include/opencv2/ocl/private/opencl_dumpinfo.hpp:89:37: error: ‘platforms’ was not declared in this scope
    /home/sello/opencv-2.4.9/modules/ocl/include/opencv2/ocl/private/opencl_dumpinfo.hpp:95:19: error: ‘DevicesInfo’ in namespace ‘cv::ocl’ does not name a type
    /home/sello/opencv-2.4.9/modules/ocl/include/opencv2/ocl/private/opencl_dumpinfo.hpp:96:39: error: ‘devices’ was not declared in this scope
    /home/sello/opencv-2.4.9/modules/ocl/include/opencv2/ocl/private/opencl_dumpinfo.hpp:98:23: error: ‘DeviceInfo’ in namespace ‘cv::ocl’ does not name a type
    /home/sello/opencv-2.4.9/modules/ocl/include/opencv2/ocl/private/opencl_dumpinfo.hpp:99:33: error: ‘current_device’ was not declared in this scope
    /home/sello/opencv-2.4.9/modules/ocl/include/opencv2/ocl/private/opencl_dumpinfo.hpp:99:62: error: ‘CVCL_DEVICE_TYPE_CPU’ was not declared in this scope
    /home/sello/opencv-2.4.9/modules/ocl/include/opencv2/ocl/private/opencl_dumpinfo.hpp:100:71: error: ‘CVCL_DEVICE_TYPE_GPU’ was not declared in this scope
    In file included from /home/sello/opencv-2.4.9/modules/nonfree/perf/perf_main.cpp:28:0:
    /home/sello/opencv-2.4.9/modules/ocl/include/opencv2/ocl/private/opencl_dumpinfo.hpp:108:15: error: ‘DeviceInfo’ in namespace ‘cv::ocl’ does not name a type
    /home/sello/opencv-2.4.9/modules/ocl/include/opencv2/ocl/private/opencl_dumpinfo.hpp:110:9: error: ‘deviceInfo’ was not declared in this scope
    /home/sello/opencv-2.4.9/modules/ocl/include/opencv2/ocl/private/opencl_dumpinfo.hpp:111:9: error: ‘deviceInfo’ was not declared in this scope
    /home/sello/opencv-2.4.9/modules/ocl/include/opencv2/ocl/private/opencl_dumpinfo.hpp:113:25: error: ‘deviceInfo’ was not declared in this scope
    /home/sello/opencv-2.4.9/modules/ocl/include/opencv2/ocl/private/opencl_dumpinfo.hpp:113:50: error: ‘CVCL_DEVICE_TYPE_CPU’ was not declared in this scope
    /home/sello/opencv-2.4.9/modules/ocl/include/opencv2/ocl/private/opencl_dumpinfo.hpp:114:61: error: ‘CVCL_DEVICE_TYPE_GPU’ was not declared in this scope
    make[2]: *** [modules/nonfree/CMakeFiles/opencv_perf_nonfree.dir/perf/perf_main.cpp.o] Error 1
    make[1]: *** [modules/nonfree/CMakeFiles/opencv_perf_nonfree.dir/all] Error 2
    make: *** [all] Error 2

    ReplyDelete
  35. Only blog that helped me with easy installation

    ReplyDelete
  36. Hi,
    thank you for this tutorial, very useful.
    I also have the problem that the "c" folder in the "samples" folder, is missing! So I can't run build_all.sh
    I have the "cpp" folder and in that is not working as well.
    Somebody have the solution?
    Thanks you in advance!

    Ubuntu 14 / OpenCV 3.0 alpha

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. I am having the same problem... whats the solution?

      Delete
  37. Is there a way to run a command line program that will return the number of faces in a picture?
    I would like to use it in a bash script and as far as I understand "facedetect" only shows you what is possible, it doesn't return boolean values like "there is a face" or "there isn't a face"
    Thank you!

    ReplyDelete
  38. When building OpenCV, you may want to add the job "-j" flag to the make command with the number of physical cores on your machine (i.e.make -j4) to decrease build time.

    ReplyDelete
  39. Very much informative steps for the installation of ubuntu linux. Thank you very much. Best IT company in coimbatore | Best web site developer

    ReplyDelete
  40. Trik Mmebuat Doping Agar Menjadi Ganas Dan Kuat Klik Di Sini

    Agen Sabung Ayam Online Terbaik Dan Juga Terpercaya http://www.bakarayam.co

    Informasi Terlengkap Mengenai Sabung Ayam

    https://bvayamsate.weebly.com/blog/panduan-makanan-ternak-ayam-bangkok-usia-di-bawah-6-bulan/

    ReplyDelete
  41. This comment has been removed by the author.

    ReplyDelete
  42. Pemahaman kata dinamis dan statis menarik jika dihubungkan dengan judi online satu ini, yaitu dengan Main Domino QQ Online versi Mobile. Pertanyaannya kenapa harus bermain dengan cara dimanis ? Dan Apa itu dinamis ? (Baca Selengkapnya...)

    ReplyDelete
  43. This blog aware me about different programs which can become very useful for our friends and kids. Few websites provide combined courses and few of the are separately for single subject. Glad to get this information. avg vpn review

    ReplyDelete
  44. Truly a fine approach to express and looking an exceptionally charming article with loaded with solid data. I am unquestionably going to enlighten in my class concerning this stage and the data shared here. Extremely elegantly composed. watch cartoon online

    ReplyDelete
  45. Wow! This is the perfect blog I am looking this type of blog its awesome blog here , share great information about this topic. This informative blog helps many readers with their decision-making regarding the situation. Great articles and will look forward for more! kahoot bot

    ReplyDelete
  46. This comment has been removed by the author.

    ReplyDelete
  47. We are the trusted washing machine repair service provider company in all over Dubai areas. We have many years of experienced in washing machine repairing and maintenance.
    washing machine repair Deira Dubai
    washing machine repair bur Dubai
    washing machine repair Dubai investment park

    ReplyDelete
  48. Good. I am really impressed with your writing talents and also with the layout on your weblog. Appreciate, Is this a paid subject matter or did you customize it yourself? Either way keep up the nice quality writing, it is rare to peer a nice weblog like this one nowadays. Thank you, check also virtual edge and conference gifts for attendees

    ReplyDelete
  49. Great information, thanks for sharing it with us 파친코사이트

    ReplyDelete
  50. "Excellent blog you have here.. It’s difficult to find quality writing like yours nowadays. I really appreciate individuals like you! Take care!!
    I could not refrain from commenting. Exceptionally well written."

    야동

    ReplyDelete
  51. "Howdy! Would you mind if I share your blog with my zynga group?
    There’s a lot of people that I think would really enjoy your content.

    Please let me know. Thank you"

    오피

    ReplyDelete
  52. I’m not sure where you’re getting your information, but great topic. I needs to spend some time learning much more or understanding more. Thanks for great information I was looking for this info for my mission.

    마사지

    ReplyDelete
  53. Excellent blog right here! Additionally your website a lot up very fast! What web host are you the usage of? Can I am getting your affiliate hyperlink on your host? I want my website loaded up as quickly as yours lol 건전마사지

    ReplyDelete
  54. top accounting software
    Your article is so insightful and detailed that I got to learn new concepts and develop my skills.. thank you so much

    ReplyDelete
  55. Thank you so much for such a well-written article. It’s full of insightful information. Your point of view is the best among many without fail.For certain, It is one of the best blogs in my opinion. 먹튀검증

    ReplyDelete
  56. This comment has been removed by the author.

    ReplyDelete
  57. Is it valid or not that you are sure about the source?
    I wish to convey my respect for your generosity supporting individuals who require course on this one subject. Halloween Costume

    ReplyDelete