{"id":1405,"date":"2015-05-04T23:01:27","date_gmt":"2015-05-04T15:01:27","guid":{"rendered":"http:\/\/www.magicandlove.com\/blog\/?p=1405"},"modified":"2015-07-30T14:41:30","modified_gmt":"2015-07-30T06:41:30","slug":"opencv-and-processing-1","status":"publish","type":"post","link":"http:\/\/www.magicandlove.com\/blog\/2015\/05\/04\/opencv-and-processing-1\/","title":{"rendered":"OpenCV and Processing 1"},"content":{"rendered":"<p>This is the beginning of a series of posts related to using<a href=\"http:\/\/opencv.org\"> OpenCV<\/a> and <a href=\"http:\/\/processing.org\">Processing<\/a> in the Linux environment. I built the OpenCV 3.0.0 rc1 in Ubuntu. By putting the 2 files, <strong>libopencv_java300.so<\/strong> and <strong>opencv-300.jar<\/strong> in the <strong>code<\/strong> folder of a sketch, I can use the alpha version 3.0a7 of Processing and the official Java binding of OpenCV together to prepare for the examples of a newly proposed book in image processing and computer vision. I do not use the <a href=\"https:\/\/github.com\/atduskgreg\/opencv-processing\">OpenCV for Processing library<\/a> by <a href=\"http:\/\/gregborenstein.com\/\">Greg Borenstein<\/a>, in order to reveal the underlying working mechanism of OpenCV for learning purpose.<br \/>\n&nbsp;<br \/>\n<!--more--><\/p>\n<p>The Processing codes should work in the OSX and Windows platforms. The latest <a href=\"http:\/\/docs.opencv.org\/java\/\">javadoc<\/a> I can find online is 2.4.11 that I believe there are significant changes from OpenCV 2 to OpenCV 3. To start with, I try to work on with the modules: <strong>core<\/strong>, <strong>highgui<\/strong>,<strong> imgproc<\/strong> and<strong> video<\/strong> first. They correspond to the Java packages<\/p>\n<ul>\n<li>org.opencv.core<\/li>\n<li>org.opencv.highgui<\/li>\n<li>org.opencv.imgproc<\/li>\n<li>org.opencv.video<\/li>\n<\/ul>\n<p><strong>Example 1<\/strong><\/p>\n<pre lang=\"java\">\r\nimport org.opencv.core.Core;\r\n\r\nvoid setup() {\r\n  size(640, 480);\r\n  println(Core.VERSION);\r\n  println(Core.NATIVE_LIBRARY_NAME);\r\n}\r\n\r\nvoid draw() {\r\n  background(0);\r\n}\r\n<\/pre>\n<p>&nbsp;<br \/>\nThe console output will be<\/p>\n<pre>\r\n3.0.0-rc1\r\nopencv_java300\r\n<\/pre>\n<p><strong>Core.VERSION<\/strong> contains the version identifier of the OpenCV library. <strong>Core.NATIVE_LIBRARY_NAME<\/strong> is the native library name where we are going to load before using the OpenCV functions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the beginning of a series of posts related to using OpenCV and Processing in the Linux environment. I built the OpenCV 3.0.0 rc1 in Ubuntu. By putting the 2 files, libopencv_java300.so and opencv-300.jar in the code folder of a sketch, I can use the alpha version 3.0a7 of Processing and the official Java [&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,79],"tags":[3,62],"class_list":["post-1405","post","type-post","status-publish","format-standard","hentry","category-books","category-software-2","tag-opencv","tag-processing-org"],"_links":{"self":[{"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts\/1405","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=1405"}],"version-history":[{"count":6,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts\/1405\/revisions"}],"predecessor-version":[{"id":1624,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts\/1405\/revisions\/1624"}],"wp:attachment":[{"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/media?parent=1405"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/categories?post=1405"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/tags?post=1405"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}