{"id":1992,"date":"2017-02-24T08:21:32","date_gmt":"2017-02-24T08:21:32","guid":{"rendered":"http:\/\/myprojects.advchaweb.com\/?p=1992"},"modified":"2017-02-24T08:46:34","modified_gmt":"2017-02-24T08:46:34","slug":"1992","status":"publish","type":"post","link":"https:\/\/myprojects.advchaweb.com\/index.php\/2017\/02\/24\/1992\/","title":{"rendered":"Configure CodeBlock With OpenCV"},"content":{"rendered":"<p>CONFIGURE CODEBLOCK WITH OPENCV<br \/>\nref:<a href=\"http:\/\/jonniedub.blogspot.co.id\/2013\/01\/setting-up-codeblocks-ide-for-use-with.html?showComment=1454444260714#c506464558721086998\">http:\/\/jonniedub.blogspot.co.id\/2013\/01\/setting-up-codeblocks-ide-for-use-with.html?showComment=1454444260714#c506464558721086998<\/a><br \/>\n<a href=\"http:\/\/blog.csdn.net\/mummyding\/article\/details\/49804921\">http:\/\/blog.csdn.net\/mummyding\/article\/details\/49804921<\/a><br \/>\n1. Create new project:<br \/>\nFile -&gt; New -&gt; Project&#8230;-&gt; Find &#8216;OpenCV Project&#8217; -&gt; click &#8216;Go&#8217; -&gt; Next -&gt; Write Project Title and the Path -&gt;<br \/>\nCompiler: GNU GCC Compiler -&gt; Finish<\/p>\n<p>2. Default opencv template (main.cpp in \/Sources\/ directory) is created. Here is main.cpp:<\/p>\n<pre class=\"lang:default decode:true \">#include &lt;opencv2\/core\/core.hpp&gt;\r\n#include &lt;opencv2\/imgproc\/imgproc.hpp&gt;\r\n#include &lt;opencv2\/highgui\/highgui.hpp&gt;\r\nusing namespace cv;\r\n\r\nint main(int argc, char *argv[])\r\n{\r\nMat img = imread(\"lena.jpg\", CV_LOAD_IMAGE_COLOR);\r\nif(img.empty())\r\nreturn -1;\r\nnamedWindow( \"lena\", CV_WINDOW_AUTOSIZE );\r\nimshow(\"lena\", img);\r\nwaitKey(0);\r\nreturn 0;\r\n}<\/pre>\n<p>3. Its time to configure this project so it&#8217;d be linked to opencv library.<br \/>\nFrom eclipse configuration above, we get the libraries path by using:<br \/>\npkg-config &#8211;cflags opencv<br \/>\npkg-config &#8211;libs opencv<br \/>\nWe&#8217;ll do the same here:<br \/>\na. Right click the Project Name &#8216;OpenCV&#8217; -&gt; Build Options -&gt; Click the Project name (OpenCV) DO NOT the &#8216;Debug&#8217; -&gt;<br \/>\nSearch directories tab -&gt; Compiler tab -&gt; click Add -&gt; fill with: \/usr\/local\/include\/opencv<br \/>\nb. then click Linker tab -&gt; click Add -&gt; fill with: \/usr\/local\/lib<br \/>\nc. Then at Linker settings tab -&gt; In Link Libraries, Add this (one by one):<br \/>\nopencv_core<br \/>\nopencv_imgcodecs<br \/>\nopencv_highgui<\/p>\n<p>In Others linker options:, add:<br \/>\n`opencv-config &#8211;ldstaticflags`<\/p>\n<p>d. click OK<\/p>\n<p>4. Test it!<br \/>\nRight click the Project name &#8216;OpenCV&#8217; -&gt; Build<br \/>\nmake sure everything okay<br \/>\nThen click &#8216;Run&#8217; (the green arrow) or from Build -&gt; Run<br \/>\nSHORTCUT: F9 (Build and Run at ONCE!)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CONFIGURE CODEBLOCK WITH OPENCV ref:http:\/\/jonniedub.blogspot.co.id\/2013\/01\/setting-up-codeblocks-ide-for-use-with.html?showComment=1454444260714#c506464558721086998 http:\/\/blog.csdn.net\/mummyding\/article\/details\/49804921 1. Create new project: File -&gt; New -&gt; Project&#8230;-&gt; Find &#8216;OpenCV Project&#8217; -&gt; click &#8216;Go&#8217; -&gt; Next -&gt; Write Project Title and the Path -&gt; Compiler: GNU GCC Compiler -&gt; Finish 2. Default opencv template (main.cpp in \/Sources\/ directory) is created. Here is main.cpp: #include &lt;opencv2\/core\/core.hpp&gt; #include &lt;opencv2\/imgproc\/imgproc.hpp&gt; #include &hellip; <a href=\"https:\/\/myprojects.advchaweb.com\/index.php\/2017\/02\/24\/1992\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Configure CodeBlock With OpenCV&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,20],"tags":[],"class_list":["post-1992","post","type-post","status-publish","format-standard","hentry","category-c-2","category-opencv"],"_links":{"self":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/1992","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/comments?post=1992"}],"version-history":[{"count":3,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/1992\/revisions"}],"predecessor-version":[{"id":1996,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/1992\/revisions\/1996"}],"wp:attachment":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/media?parent=1992"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/categories?post=1992"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/tags?post=1992"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}