{"id":1983,"date":"2017-02-24T08:12:28","date_gmt":"2017-02-24T08:12:28","guid":{"rendered":"http:\/\/myprojects.advchaweb.com\/?p=1983"},"modified":"2017-02-24T08:16:06","modified_gmt":"2017-02-24T08:16:06","slug":"configure-eclipse-with-c-and-opencv","status":"publish","type":"post","link":"https:\/\/myprojects.advchaweb.com\/index.php\/2017\/02\/24\/configure-eclipse-with-c-and-opencv\/","title":{"rendered":"Configure Eclipse With C++ And OpenCV"},"content":{"rendered":"<p>CONFIGURE ECLIPSE WITH C++ AND OPENCV<br \/>\nref:<a href=\"http:\/\/rodrigoberriel.com\/2014\/10\/using-opencv-3-0-0-with-eclipse\/\">http:\/\/rodrigoberriel.com\/2014\/10\/using-opencv-3-0-0-with-eclipse\/<\/a><br \/>\n1. Assumed eclipse and cdt (C++ Development tools) already installed. if not, pls follow this:<\/p>\n<p>a. Install C++ Development (CDT):<br \/>\nref:<a href=\"https:\/\/eclipse.org\/cdt\/downloads.php\">https:\/\/eclipse.org\/cdt\/downloads.php<\/a><br \/>\nHelp -&gt; Install New Software -&gt; Add&#8230; -&gt;<br \/>\nAdd Repository form:<br \/>\nName: C++ Development Tools<br \/>\nLocation: <a href=\"http:\/\/download.eclipse.org\/tools\/cdt\/releases\/8.8.1\">http:\/\/download.eclipse.org\/tools\/cdt\/releases\/8.8.1<\/a> (CDT 8.8.1 FOR ECLIPSE MARS)<\/p>\n<p>b. Check All and Install<\/p>\n<p>2. Creating a New C++ Project on Eclipse<br \/>\na. File \u00bb New \u00bb C++ Project;<br \/>\nb. Give a name to your project in Project Name; for example: TestOpenCV<br \/>\nc. Choose Executable \u00bb Empty Project in Project Type;<br \/>\nd. Check Linux GCC in Toolchains and press Next;<br \/>\ne. Click on Finish;<\/p>\n<p>3. Linking OpenCV to the newly created project<br \/>\na. Select the project and go to the menu Project \u00bb Properties (or press Alt+ENTER);<br \/>\nb. We\u2019re going to modify somethings on Tool Settings tab of C\/C++ Build \u00bb Settings;<br \/>\nc. In GCC C++ Compiler \u00bb Includes, add &#8220;\/usr\/local\/include\/opencv&#8221; in Include paths (-l). Discover the correct path by typing the following on the terminal: pkg-config &#8211;cflags opencv;<\/p>\n<pre class=\"lang:default decode:true \">teddy@teddy-K43SJ:~$ pkg-config --cflags opencv\r\n-I\/usr\/local\/include\/opencv -I\/usr\/local\/include<\/pre>\n<p>d. Go to GCC C++ Linker \u00bb Libraries and add &#8220;\/usr\/local\/lib&#8221; in Library search paths (-L). Discover the correct path by typing the following on the terminal:: pkg-config &#8211;libs opencv;<\/p>\n<pre class=\"lang:default decode:true \">teddy@teddy-K43SJ:~$ pkg-config --libs opencv\r\n-L\/usr\/local\/lib -lopencv_cudabgsegm -lopencv_cudaobjdetect -lopencv_cudastereo -lopencv_stitching -lopencv_cudafeatures2d -lopencv_superres -lopencv_cudacodec -lopencv_videostab -lopencv_cudaoptflow -lopencv_cudalegacy -lopencv_cudawarping -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn -lopencv_dpm -lopencv_fuzzy -lopencv_line_descriptor -lopencv_optflow -lopencv_plot -lopencv_reg -lopencv_saliency -lopencv_stereo -lopencv_structured_light -lopencv_rgbd -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_face -lopencv_xfeatures2d -lopencv_shape -lopencv_video -lopencv_ximgproc -lopencv_calib3d -lopencv_features2d -lopencv_flann -lopencv_xobjdetect -lopencv_objdetect -lopencv_ml -lopencv_xphoto -lippicv -lopencv_highgui -lopencv_videoio -lopencv_photo -lopencv_imgcodecs -lopencv_cudaimgproc -lopencv_cudafilters -lopencv_imgproc -lopencv_cudaarithm -lopencv_core -lopencv_cudev<\/pre>\n<p>e. Still in GCC C++ Linker \u00bb Libraries, add the libraries you\u2019ll need in your project in Libraries (-l). We\u2019re going to need 3 to our project (don\u2019t forget to link opencv_imgcodecs, since imread() has moved to it in OpenCV 3):<br \/>\nopencv_core<br \/>\nopencv_imgcodecs<br \/>\nopencv_highgui<\/p>\n<pre class=\"lang:default decode:true \">teddy@teddy-K43SJ:~$ cd \/usr\/local\/lib\/\r\nteddy@teddy-K43SJ:\/usr\/local\/lib$ ls *opencv*so\r\nlibopencv_aruco.so libopencv_imgcodecs.so\r\nlibopencv_bgsegm.so libopencv_imgproc.so\r\nlibopencv_bioinspired.so libopencv_line_descriptor.so\r\nlibopencv_calib3d.so libopencv_ml.so\r\nlibopencv_ccalib.so libopencv_objdetect.so\r\nlibopencv_core.so libopencv_optflow.so\r\nlibopencv_cudaarithm.so libopencv_photo.so\r\nlibopencv_cudabgsegm.so libopencv_plot.so\r\nlibopencv_cudacodec.so libopencv_reg.so\r\nlibopencv_cudafeatures2d.so libopencv_rgbd.so\r\nlibopencv_cudafilters.so libopencv_saliency.so\r\nlibopencv_cudaimgproc.so libopencv_shape.so\r\nlibopencv_cudalegacy.so libopencv_stereo.so\r\nlibopencv_cudaobjdetect.so libopencv_stitching.so\r\nlibopencv_cudaoptflow.so libopencv_structured_light.so\r\nlibopencv_cudastereo.so libopencv_superres.so\r\nlibopencv_cudawarping.so libopencv_surface_matching.so\r\nlibopencv_cudev.so libopencv_text.so\r\nlibopencv_datasets.so libopencv_tracking.so\r\nlibopencv_dnn.so libopencv_videoio.so\r\nlibopencv_dpm.so libopencv_video.so\r\nlibopencv_face.so libopencv_videostab.so\r\nlibopencv_features2d.so libopencv_xfeatures2d.so\r\nlibopencv_flann.so libopencv_ximgproc.so\r\nlibopencv_fuzzy.so libopencv_xobjdetect.so\r\nlibopencv_highgui.so libopencv_xphoto.so<\/pre>\n<p>Done!<\/p>\n<p>4. Lets test it!<br \/>\na. Right-click on the project in Project Explorer and go to New \u00bb Folder;<br \/>\nb. Give a name to the folder, for instance: src.<br \/>\nc. Right-click on the src folder and go to New \u00bb File;<br \/>\nb. Give a name to the file, for instance: DisplayImage.cpp and type (or copy and paste) the code snippet below. Don\u2019t forget to save the file.<\/p>\n<pre class=\"lang:default decode:true\">#include &lt;opencv2\/opencv.hpp&gt;\r\n\r\nusing namespace cv;\r\n\r\nint main(void){\r\n    Mat inputImg=imread(\"\/home\/teddy\/opencv\/samples\/data\/lena.jpg\");\r\n\r\n    imshow(\"Input Image\",inputImg);\r\n    waitKey(0);\r\n    return 0;\r\n}<\/pre>\n<p>Project \u00bb Build All (or Ctrl+B) to build;<\/p>\n<p>5. Run the program<br \/>\na. Right-click on the project in Project Explorer and go to Run As \u00bb Local C\/C++ Application<br \/>\nb. The image should be appeared!!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CONFIGURE ECLIPSE WITH C++ AND OPENCV ref:http:\/\/rodrigoberriel.com\/2014\/10\/using-opencv-3-0-0-with-eclipse\/ 1. Assumed eclipse and cdt (C++ Development tools) already installed. if not, pls follow this: a. Install C++ Development (CDT): ref:https:\/\/eclipse.org\/cdt\/downloads.php Help -&gt; Install New Software -&gt; Add&#8230; -&gt; Add Repository form: Name: C++ Development Tools Location: http:\/\/download.eclipse.org\/tools\/cdt\/releases\/8.8.1 (CDT 8.8.1 FOR ECLIPSE MARS) b. Check All and Install &hellip; <a href=\"https:\/\/myprojects.advchaweb.com\/index.php\/2017\/02\/24\/configure-eclipse-with-c-and-opencv\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Configure Eclipse With C++ And 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-1983","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\/1983","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=1983"}],"version-history":[{"count":3,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/1983\/revisions"}],"predecessor-version":[{"id":1987,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/1983\/revisions\/1987"}],"wp:attachment":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/media?parent=1983"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/categories?post=1983"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/tags?post=1983"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}