{"id":1988,"date":"2017-02-24T08:17:02","date_gmt":"2017-02-24T08:17:02","guid":{"rendered":"http:\/\/myprojects.advchaweb.com\/?p=1988"},"modified":"2017-02-24T08:20:14","modified_gmt":"2017-02-24T08:20:14","slug":"configure-netbeans-c-with-opencv","status":"publish","type":"post","link":"https:\/\/myprojects.advchaweb.com\/index.php\/2017\/02\/24\/configure-netbeans-c-with-opencv\/","title":{"rendered":"Configure Netbeans C++ With OpenCV"},"content":{"rendered":"<p>CONFIGURE NETBEANS C++ WITH OPENCV<br \/>\nref: <a href=\"http:\/\/www.technical-recipes.com\/2015\/configure-netbeans-to-use-opencv-in-linux-environments\/\">http:\/\/www.technical-recipes.com\/2015\/configure-netbeans-to-use-opencv-in-linux-environments\/<\/a><br \/>\n1. Create C++ Application Project<br \/>\nFile-&gt;New Project-&gt;C\/C++ -&gt;C\/C++ Application-&gt;Next-&gt;&#8217;Give it the Project name and the location&#8217; AND CHOOSE C++11-&gt;Finish<\/p>\n<p>2. Configure the compiler:<br \/>\nRight Click The project-&gt;Properties-&gt;Build-&gt;C++ Compiler-&gt;&#8217;Include Directories&#8217;: \/usr\/local\/include\/opencv -&gt;Apply<\/p>\n<p>3. Add the opencv libraries:<br \/>\nRight Click The project-&gt;Properties-&gt;Build-&gt;Linker-&gt;&#8217;Additional Library Directories&#8217;: \/usr\/local\/lib -&gt;Apply<br \/>\nRight Click The project-&gt;Properties-&gt;Build-&gt;Linker-&gt;&#8217;Libraries&#8217;: Add -&gt; Click Add Library THEN GO TO \/usr\/local\/lib -&gt;CLICK (SIMULTANEOUSLY) libopencv_core.so, libopencv_highgui.so, libopencv_imgproc.so, libopencv_imgcodecs.so<br \/>\nOK<\/p>\n<p>NOTE: TO SHOW VIDEO CAPTURE, ADD libopencv_videoio.so<br \/>\n4. Test<br \/>\nin main.cpp:<\/p>\n<pre class=\"lang:default decode:true \">\/*\r\n* To change this license header, choose License Headers in Project Properties.\r\n* To change this template file, choose Tools | Templates\r\n* and open the template in the editor.\r\n*\/\r\n\r\n\/*\r\n* File: main.cpp\r\n* Author: teddy\r\n*\r\n* Created on April 13, 2016, 10:04 AM\r\n*\/\r\n#include &lt;opencv2\/opencv.hpp&gt;\r\n#include &lt;iostream&gt;\r\n\r\nusing namespace cv;\r\nusing namespace std;\r\n\r\n\/*\r\n*\r\n*\/\r\nint main(int argc, char** argv) {\r\n    cout&lt;&lt;\"OPENCV VERSION: \"&lt;&lt;CV_VERSION&lt;&lt;endl;\r\n\r\n    return 0;\r\n}<\/pre>\n<p>BUILD &amp; RUN:<br \/>\nOPENCV VERSION: 3.1.0<\/p>\n<p>RUN FINISHED;<\/p>\n<p>exit value 0;<\/p>\n<p>real time: 0ms; user: 0ms; system: 0ms<br \/>\nSHOW IMAGE main.cpp:<\/p>\n<pre class=\"lang:default decode:true \">#include &lt;opencv2\/highgui\/highgui.hpp&gt;\r\n#include &lt;iostream&gt;\r\n\r\nusing namespace cv;\r\nusing namespace std;\r\n\r\nint main(int argc, char** argv) {\r\nMat img=imread(\"\/home\/teddy\/opencv\/samples\/data\/messi5.jpg\",CV_LOAD_IMAGE_UNCHANGED);\r\nif(img.empty()){\r\ncout&lt;&lt;\"Error: Image can't be opened. Check the path and the image is exist\";\r\nreturn -1;\r\n}\r\nstring winname=\"Show Image\";\r\nnamedWindow(winname,CV_WINDOW_AUTOSIZE);\r\nimshow(winname,img);\r\n\r\nwaitKey(0);\r\ndestroyWindow(winname);\r\n\r\nreturn 0;\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>VIDEO CAPTURE main.cpp (add linker libopencv_videoio.so) :<\/p>\n<pre class=\"lang:default decode:true \">\/*\r\n* File: main.cpp\r\n* Author: teddy\r\n*\r\n* Created on April 13, 2016, 10:04 AM\r\n*\/\r\n#include &lt;opencv2\/core\/core.hpp&gt;\r\n#include &lt;opencv2\/videoio\/videoio.hpp&gt;\r\n#include &lt;opencv2\/highgui\/highgui.hpp&gt;\r\n#include &lt;opencv2\/imgproc\/imgproc.hpp&gt;\r\n#include &lt;iostream&gt;\r\n\r\nusing namespace cv;\r\nusing namespace std;\r\n\r\n\/*\r\n*\r\n*\/\r\nint main(int argc, char** argv) {\r\nVideoCapture stream(0);\r\nif(!stream.isOpened()){\r\ncout&lt;&lt;\"Cannot open camera\";\r\n}\r\n\r\nbool isClosed=false;\r\nMat cameraFrame;\r\n\r\nwhile(isClosed!=true){\r\nstream.read(cameraFrame);\r\nimshow(\"Camera Stream\",cameraFrame);\r\nif(waitKey(30)&gt;=0){\r\nisClosed=true;\r\n}\r\n}\r\n\r\n\/\/cout&lt;&lt;\"OPENCV VERSION: \"&lt;&lt;CV_VERSION&lt;&lt;endl;\r\n\r\nreturn 0;\r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CONFIGURE NETBEANS C++ WITH OPENCV ref: http:\/\/www.technical-recipes.com\/2015\/configure-netbeans-to-use-opencv-in-linux-environments\/ 1. Create C++ Application Project File-&gt;New Project-&gt;C\/C++ -&gt;C\/C++ Application-&gt;Next-&gt;&#8217;Give it the Project name and the location&#8217; AND CHOOSE C++11-&gt;Finish 2. Configure the compiler: Right Click The project-&gt;Properties-&gt;Build-&gt;C++ Compiler-&gt;&#8217;Include Directories&#8217;: \/usr\/local\/include\/opencv -&gt;Apply 3. Add the opencv libraries: Right Click The project-&gt;Properties-&gt;Build-&gt;Linker-&gt;&#8217;Additional Library Directories&#8217;: \/usr\/local\/lib -&gt;Apply Right Click The project-&gt;Properties-&gt;Build-&gt;Linker-&gt;&#8217;Libraries&#8217;: &hellip; <a href=\"https:\/\/myprojects.advchaweb.com\/index.php\/2017\/02\/24\/configure-netbeans-c-with-opencv\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Configure Netbeans C++ 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-1988","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\/1988","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=1988"}],"version-history":[{"count":3,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/1988\/revisions"}],"predecessor-version":[{"id":1991,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/1988\/revisions\/1991"}],"wp:attachment":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/media?parent=1988"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/categories?post=1988"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/tags?post=1988"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}