{"id":11,"date":"2011-08-18T20:12:00","date_gmt":"2011-08-19T00:12:00","guid":{"rendered":"http:\/\/brian.digitalmaddox.com\/blog\/?p=11"},"modified":"2014-07-08T16:45:48","modified_gmt":"2014-07-08T20:45:48","slug":"building-opencv-2-3-1-on-ubuntu-11-04","status":"publish","type":"post","link":"https:\/\/brian.digitalmaddox.com\/blog\/?p=11","title":{"rendered":"Building OpenCV 2.3.1 on Ubuntu 11.04"},"content":{"rendered":"<p>Getting <a href=\"http:\/\/opencv.willowgarage.com\/wiki\/\">OpenCV<\/a> 2.3.1 to compile on Ubuntu can be interesting.\u00a0 The first issue is tracking down all of the dependencies you need to get the different parts of it to work properly.\u00a0 There is more information on dependencies needed at the OpenCV wiki <a href=\"http:\/\/opencv.willowgarage.com\/wiki\/InstallGuide\">here<\/a> and <a href=\"http:\/\/opencv.willowgarage.com\/wiki\/InstallGuide%20%3A%20Debian\">here<\/a>.\u00a0 I found <a href=\"http:\/\/www.samontab.com\/web\/2011\/06\/installing-opencv-2-2-in-ubuntu-11-04\/\">this<\/a> page on a blog as well which will help to get a lot of the dependencies down.<\/p>\n<p>For me specifically, I had a couple of problems on 11.04.\u00a0 Make sure you have the following packages installed to enable gstreamer and unicap support:<\/p>\n<blockquote><p> libgstreamer-plugins-base0.10-dev<br \/>libgstreamer0.10-dev<br \/>libunicap2<br \/>libunicap2-dev<br \/>libucil2-dev<\/p><\/blockquote>\n<p>The second major problem is that OpenCV 2.3.1 doesn&#8217;t fully track the latest releases of ffmpeg.\u00a0 <a href=\"http:\/\/weichong78.blogspot.com\/2011\/07\/patch-to-build-opencv-230-with-ffmpeg.html\">This<\/a> patch helps, but bear in mind that it&#8217;s for OpenCV 2.3.0 and there have been changes between versions.\u00a0 You&#8217;ll have to install the patch by hand to take care of some of the differences.<\/p>\n<p>Once this is done, you should be ready to build.\u00a0 On my system I ran cmake as:<\/p>\n<blockquote><p><span>cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=\/usr\/local -D BUILD_PYTHON_SUPPORT=ON -D WITH_TBB=ON -D WITH_XINE=ON -D WITH_UNICAP=ON -D BUILD_EXAMPLES=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_DOCUMENTATION=ON -D BUILD_SHARED_LIBS=ON ..<\/span><\/p><\/blockquote>\n<p>If you have all of the extra media repositories on Ubuntu enabled, I&#8217;d highly recommend NOT disabling shared libraries when building OpenCV.\u00a0 You&#8217;ll avoid some linking errors due to concurrent versions of some of the multimedia libraries that might be installed.<\/p>\n<p>After that, when you compile make sure you add in something like <span>-I\/usr\/local\/include<\/span> and <span>-L\/usr\/local\/lib<\/span> to your makefile to make sure you&#8217;re pulling in the version you just compiled instead of the default and you should be good to go.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Getting OpenCV 2.3.1 to compile on Ubuntu can be interesting.\u00a0 The first issue is tracking down all of the dependencies you need to get the different parts of it to work properly.\u00a0 There is more information on dependencies needed at &hellip; <a href=\"https:\/\/brian.digitalmaddox.com\/blog\/?p=11\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,2],"tags":[],"class_list":["post-11","post","type-post","status-publish","format-standard","hentry","category-opencv","category-quicktip"],"_links":{"self":[{"href":"https:\/\/brian.digitalmaddox.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/brian.digitalmaddox.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/brian.digitalmaddox.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/brian.digitalmaddox.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/brian.digitalmaddox.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11"}],"version-history":[{"count":0,"href":"https:\/\/brian.digitalmaddox.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11\/revisions"}],"wp:attachment":[{"href":"https:\/\/brian.digitalmaddox.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/brian.digitalmaddox.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/brian.digitalmaddox.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}