{"id":1439,"date":"2015-05-28T23:16:09","date_gmt":"2015-05-28T15:16:09","guid":{"rendered":"http:\/\/www.magicandlove.com\/blog\/?p=1439"},"modified":"2015-07-30T14:37:34","modified_gmt":"2015-07-30T06:37:34","slug":"opencv-and-processing-5","status":"publish","type":"post","link":"http:\/\/www.magicandlove.com\/blog\/2015\/05\/28\/opencv-and-processing-5\/","title":{"rendered":"OpenCV and Processing 4 more"},"content":{"rendered":"<p>This example will demonstrate the use of the <a href=\"http:\/\/docs.opencv.org\/java\/org\/opencv\/core\/Rect.html\">Rect<\/a> class in OpenCV and compare it with the <a href=\"http:\/\/docs.oracle.com\/javase\/7\/docs\/api\/java\/awt\/Rectangle.html\">Rectangle<\/a> class in Java. The Rect class will be useful when we work on the face detection example later. The detected faces will be returned as rectangles.<br \/>\n&nbsp;<br \/>\n<!--more--><\/p>\n<pre lang=\"java\">\r\nimport org.opencv.core.Core;\r\nimport org.opencv.core.Rect;\r\nimport java.awt.Rectangle;\r\n\r\nvoid setup() {\r\n  size(640, 480);\r\n  println(Core.VERSION);\r\n  System.loadLibrary(Core.NATIVE_LIBRARY_NAME);\r\n  noLoop();\r\n}\r\n\r\nvoid draw() {\r\n  background(0);\r\n  Rect r1 = new Rect(10, 20, 200, 100);\r\n  Rectangle r2 = new Rectangle(10, 20, 200, 100);\r\n  println(\"Area of the rectangle \" + r1.area());\r\n  println(\"Width is \" + r2.getSize().width);\r\n  println(\"Height is \" + r2.getSize().height);\r\n}\r\n<\/pre>\n<p>The example makes use of the <strong>area()<\/strong> method of the OpenCV class <strong>Rect<\/strong>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This example will demonstrate the use of the Rect class in OpenCV and compare it with the Rectangle class in Java. The Rect class will be useful when we work on the face detection example later. The detected faces will be returned as rectangles. &nbsp;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[89,79],"tags":[3,62],"class_list":["post-1439","post","type-post","status-publish","format-standard","hentry","category-research","category-software-2","tag-opencv","tag-processing-org"],"_links":{"self":[{"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts\/1439","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=1439"}],"version-history":[{"count":3,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts\/1439\/revisions"}],"predecessor-version":[{"id":1620,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/posts\/1439\/revisions\/1620"}],"wp:attachment":[{"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/media?parent=1439"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/categories?post=1439"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.magicandlove.com\/blog\/wp-json\/wp\/v2\/tags?post=1439"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}