{"id":1912,"date":"2017-03-02T17:05:01","date_gmt":"2017-03-02T09:05:01","guid":{"rendered":"http:\/\/www.magicandlove.com\/blog\/?p=1912"},"modified":"2017-03-02T17:05:01","modified_gmt":"2017-03-02T09:05:01","slug":"opencv-3-2-java-build","status":"publish","type":"post","link":"http:\/\/www.magicandlove.com\/blog\/2017\/03\/02\/opencv-3-2-java-build\/","title":{"rendered":"OpenCV 3.2 Java Build"},"content":{"rendered":"<p>In preparing for the forthcoming book in Processing and OpenCV, I have tried to build the Java binding in OpenCV 3.2. It worked easily for the basic components. Nevertheless, when I included the <a href=\"https:\/\/github.com\/opencv\/opencv_contrib\/tree\/3.2.0\" target=\"_blank\">contribution module<\/a> &#8211; <em>optflow<\/em>, it failed. After a number of attempts in various platforms, I found it was due to the <em>gen_java.py<\/em> script in folder <em>opencv-3.2.0\/modules\/java\/generator<\/em>. I tried to add back the import details for the class <em>DenseOpticalFlow<\/em>. It worked again. Here is what I patch in the <em>gen_java.py<\/em> script.<\/p>\n<p><a href=\"http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2017\/03\/gen_java.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1913\" title=\"gen_java\" src=\"http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2017\/03\/gen_java-300x199.png\" alt=\"\" width=\"300\" height=\"199\" srcset=\"http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2017\/03\/gen_java-300x199.png 300w, http:\/\/www.magicandlove.com\/blog\/wp-content\/uploads\/2017\/03\/gen_java.png 926w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>For those who do not want to build it yourselves, you can download a pre-built version of the <a href=\"http:\/\/www.magicandlove.com\/software\/opencv_java320.zip\" target=\"_blank\">OpenCV 3.2 Java library<\/a>. You can use it with Processing immediately. I have tested it with the current Processing at 3.3. It contains the following files for various platforms in 64 bit:<\/p>\n<ul>\n<li>libopencv_java320.dylib<\/li>\n<li>libopencv_java320.so<\/li>\n<li>opencv_java320.dll<\/li>\n<li>opencv-320.jar<\/li>\n<\/ul>\n<p>Enjoy and happy coding.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In preparing for the forthcoming book in Processing and OpenCV, I have tried to build the Java binding in OpenCV 3.2. It worked easily for the basic components. Nevertheless, when I included the contribution module &#8211; optflow, it failed. After a number of attempts in various platforms, I found it was due to the gen_java.py [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[88,89,79],"tags":[111,3],"class_list":["post-1912","post","type-post","status-publish","format-standard","hentry","category-books","category-research","category-software-2","tag-java","tag-opencv"],"_links":{"self":[{"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts\/1912","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/comments?post=1912"}],"version-history":[{"count":1,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts\/1912\/revisions"}],"predecessor-version":[{"id":1914,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts\/1912\/revisions\/1914"}],"wp:attachment":[{"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/media?parent=1912"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/categories?post=1912"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/tags?post=1912"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}