{"id":2140,"date":"2009-12-14T15:02:00","date_gmt":"2009-12-14T14:02:00","guid":{"rendered":"http:\/\/pkmital.com\/home\/?p=57"},"modified":"2009-12-14T15:02:00","modified_gmt":"2009-12-14T14:02:00","slug":"opencv-2-0-introduces-cpp-style-coding-and-more","status":"publish","type":"post","link":"https:\/\/pkmital.com\/home\/opencv-2-0-introduces-cpp-style-coding-and-more\/","title":{"rendered":"OpenCV 2.0 Introduces CPP Style Coding and More"},"content":{"rendered":"<p>No more <span style=\"font-family: &quot;Courier New&quot;,Courier,monospace;\">void *<\/span>&#8216;s apparently. And they&#8217;ve got constructors and destructors.<\/p>\n<p>Check out the documentation here: <a href=\"http:\/\/opencv.willowgarage.com\/documentation\/cpp\/index.html\">http:\/\/opencv.willowgarage.com\/documentation\/cpp\/index.html<\/a><\/p>\n<p>Notably, the memory management seems to be much nicer as destructors are called when there are no more references to the object. <\/p>\n<p>As well, quickly accessing data row or plane major seems to be much easier now:<\/p>\n<p>e.g. plane access:<br \/><span style=\"font-family: &quot;Courier New&quot;,Courier,monospace;\">\/\/ split the image into separate color planes<\/span><br \/><span style=\"font-family: &quot;Courier New&quot;,Courier,monospace;\">vector<mat> planes;<\/mat><\/span><br \/><span style=\"font-family: &quot;Courier New&quot;,Courier,monospace;\">split(img_yuv, planes);<\/span><\/p>\n<p><span style=\"font-family: &quot;Courier New&quot;,Courier,monospace;\">\/\/ access with iterators:<\/span><br \/><span style=\"font-family: &quot;Courier New&quot;,Courier,monospace;\">MatIterator_<uchar> it = planes[0].begin<uchar>(),<\/uchar><\/uchar><\/span><br \/><span style=\"font-family: &quot;Courier New&quot;,Courier,monospace;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; it_end = planes[0].end<uchar>();<\/uchar><\/span><\/p>\n<p>As well, they have implemented STL-like class traits for easily declaring matrices with the normal c++ primitives without having to remember <span style=\"font-family: &quot;Courier New&quot;,Courier,monospace;\">CV_64F<\/span> etc&#8230; <\/p>\n<p>e.g.:<br \/><span style=\"font-family: &quot;Courier New&quot;,Courier,monospace;\">Mat A(30, 40, DataType<float>::type);<\/float><\/span><br \/><span style=\"font-family: &quot;Courier New&quot;,Courier,monospace;\">Mat B = Mat_<std::complex><double> &gt;(3, 3);<\/double><\/std::complex><\/span><\/p>\n<p>There is a whole lot more introduced including a revamped interface system, many more machine learning and computer vision algorithms, <a href=\"http:\/\/www.openmp.org\/\">OMP<\/a> integration, and probably a lot more.&nbsp; I&#8217;ll be playing with it to see what else is going on.&nbsp; Hopefully the openframeworks community will pick up on it as well and integrate it into their next major release.&nbsp; I know I&#8217;ll be doing so for my projects.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>No more void *&#8216;s apparently. And they&#8217;ve got constructors and destructors. Check out the documentation here: http:\/\/opencv.willowgarage.com\/documentation\/cpp\/index.html Notably, the memory management seems to be much nicer as destructors are called&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[262],"class_list":["post-2140","post","type-post","status-publish","format-standard","hentry","category-technology","tag-opencv"],"acf":[],"_links":{"self":[{"href":"https:\/\/pkmital.com\/home\/wp-json\/wp\/v2\/posts\/2140","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pkmital.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pkmital.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pkmital.com\/home\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/pkmital.com\/home\/wp-json\/wp\/v2\/comments?post=2140"}],"version-history":[{"count":0,"href":"https:\/\/pkmital.com\/home\/wp-json\/wp\/v2\/posts\/2140\/revisions"}],"wp:attachment":[{"href":"https:\/\/pkmital.com\/home\/wp-json\/wp\/v2\/media?parent=2140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pkmital.com\/home\/wp-json\/wp\/v2\/categories?post=2140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pkmital.com\/home\/wp-json\/wp\/v2\/tags?post=2140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}