OpenCV with Netbeans IDE

UPDATE: It’s been a long time since I wrote this article, it’s now obsoleted.   For the newer version of OpenCV ( >2.2) I recommend to look for the related information from this site:
And the installation details are on this site:
However, it doesn’t have the tutorial on how to use OpenCV with Netbeans. I’ll try to do it myself when I do have time and then update this page as soon as possible. Best Wish.

From previous blog, I already mention what the OpenCV is and how to install OpenCV on Linux. For those who have not install OpenCV, following this link:
But since the writing C++ language without any help from GUI is such a very bitter taste, many developer tends to use GUI for theirs projects. In OpenCV wiki ( mentions how to setting up OpenCV with MS Visual Studio, and Eclipse. But after I tried for a few hours, I found that Netbeans IDE is much easier to use. This is the step to setting up OpenCV with Netbeans.

1. Download latest OpenCV here
2. Untar and Install Netbeans. Goto Terminal->to folder
sudo sh .sh
Then follow the install instructions.
3. Open Netbeans then do the following:
Select Tools -> Options -> C/C++ -> Code Assistance -> add Include Directories
(For me, /usr/local/include/opencv)
4. Create new project, then:
Right click on Project Name -> Properties ->Build -> C++ Compiler -> Include Directories
Include Directories : /usr/local/include/opencv
5. Right click on Project Name -> Properties -> Build -> linker ->
Include Directories : /usr/local/include/opencv
Additional Options : -I/usr/local/include/opencv -L/usr/local/lib -lcxcore -lcv -lhighgui -lcvaux -lml
Then writing program and compile!!

7 thoughts on “OpenCV with Netbeans IDE

  1. Hi,

    I could follow your instruction until step5, where I could not find “Include Directories” under the linker. Additionally, I could not get the last line too (additional options:). I am using Netbeans IDE 6.7.1 with opencv version 1.2. Highly appreciate what you have shared and looking forward to your reply.

    Best regards,


    1. For step 5, place library folder (ex./usr/include/opencv) at the line where it’s says “Additional Library Directories” under General category.
      Also put “-I/usr/local/include/opencv -L/usr/local/lib -lcxcore -lcv -lhighgui -lcvaux -lml” into “Additional Options” under Command Line category.

      I also appreciate you interest in my blog (as the first reply, actually). Feel free to ask if you have any questions and I would try my best to answer.

  2. Using NetBeans 6.8 / Ubuntu 9.10 AMD-64 with my OpenCV build.
    Steps 1-4 are good and …
    The follow-up to Albert’s problem, step 5
    … in the [Projects tree] (select your work project)
    right-click Properties => Linker
    Additional Options […]
    -I/usr/local/include/opencv -L/usr/local/lib -lcxcore -lcv -lhighgui -lcvaux -lml
    Be sure you have that information in BOTH DeBug and Release Configuration

    Thank you. Your blog is the ONLY google on the whole www that shows this knowledge.

  3. if it’s qt app then add
    -L/usr/local/lib -lcxcore -lcv -lhighgui -lcvaux -lml

    to yourProject->properties->Linker->Libraries

  4. Dear sir,

    Is it necessary to download cygwin or other compilers before these steps?
    I red it in some other blogs that first of all we should download cygwin and import it to netbeans and then do the rest.

    yours faithfully

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s