{"id":569,"date":"2017-04-26T20:51:44","date_gmt":"2017-04-26T20:51:44","guid":{"rendered":"http:\/\/www.jontrinder.com\/blog\/?p=569"},"modified":"2017-05-04T09:34:58","modified_gmt":"2017-05-04T09:34:58","slug":"opencv-3-and-ffmpeg-fun","status":"publish","type":"post","link":"https:\/\/www.jontrinder.com\/blog\/?p=569","title":{"rendered":"OpenCV 3 and ffmpeg fun"},"content":{"rendered":"<p>Had a few hours of \u00a0&#8216;fun&#8217; getting OpenCV3 to build&#8230; I will expand on that sometime, meantime some reminders<\/p>\n<p>Some reminders mainly to me&#8230;<\/p>\n<p>The main problem was configure for OpenCV would not find ffmpeg, in spite of all the solutions to the problem posted around the web, none worked. In the end I reinstalled OpenCV from source.<\/p>\n<p>Note below the configure needs some specific flags or open CV will get grumpy.<\/p>\n<p><strong>opencv<\/strong><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nclear build folder with rm -r\r\n\r\n\r\n#before doing the\r\n\r\ncmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=\/usr\/local&lt;\/pre&gt;\r\n&lt;pre&gt;<\/pre>\n<p>or<br \/>\ncmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=\/usr\/local -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D OPENCV_EXTRA_MODULES_PATH=~\/opencv_contrib\/modules -D BUILD_EXAMPLES=ON ..<\/p>\n<p><strong>ffmpeg<\/strong><\/p>\n<p>ffmpeg build required<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\r\n.\/configure --enable-nonfree --enable-pic --enable-shared\r\n\r\n<\/pre>\n<p>You may find ffmpeg complains when it is run of missing libraries, its the usual solution apt-get&#8230;.<\/p>\n<p><strong style=\"font-size: 16px; background-color: #ffffff; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;\">OpenCV<\/strong><br \/>\nA couple of functions I use from older version has different args, for thos a quick fix os<\/p>\n<p>#contours returns more values so&#8230;<br \/>\n(_,contours,_) = cv2.findContours(<br \/>\n#or<br \/>\ncontours, hierarchy = cv2.findContours(&#8230;)[-2:]<br \/>\n[\/sourcecode ]<\/p>\n<p>ps for the java libs it doesnt find thing unless<\/p>\n<p>export JAVA_HOME=\/usr\/local\/jdk1.8.0_20<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Had a few hours of \u00a0&#8216;fun&#8217; getting OpenCV3 to build&#8230; I will expand on that sometime, meantime some reminders Some reminders mainly to me&#8230; The main problem was configure for OpenCV would not find ffmpeg, in spite of all the &hellip; <a href=\"https:\/\/www.jontrinder.com\/blog\/?p=569\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[80,93,85],"tags":[95,94,50],"class_list":["post-569","post","type-post","status-publish","format-standard","hentry","category-computing","category-opencv","category-python","tag-ffmpeg","tag-opencv","tag-python"],"_links":{"self":[{"href":"https:\/\/www.jontrinder.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/569","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jontrinder.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jontrinder.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jontrinder.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jontrinder.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=569"}],"version-history":[{"count":12,"href":"https:\/\/www.jontrinder.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/569\/revisions"}],"predecessor-version":[{"id":582,"href":"https:\/\/www.jontrinder.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/569\/revisions\/582"}],"wp:attachment":[{"href":"https:\/\/www.jontrinder.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=569"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jontrinder.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=569"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jontrinder.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=569"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}