OpenCV with Java and C#

opencv_java_logo_small

If you haven’t already installed OpenCV, follow the instructions from here. And if you are using Windows and would like to integrate OpenCv with Visual Studio or QT, go here.

Download and install JDK from here

Download and Install Eclipse from here.

Open eclipse. On the above tab, go to Window -> Preferences -> User Libraries -> New..
sssjava1

Create New User Library with any name as shown above.

java1

Now, Click on Add External Jars and select the jar file in your OpenCV->Build->Java folder.

Then, add native libraries as OpenCV->Build->Java->x86 folder as shown below.

java2

Next time you create a Java Project, just add this library and you’re done.


OpenCV with C# – EmguCV:

If you haven’t already installed OpenCV, here is the tutorial for that.

Download and install the equivalent EmguCV version as your OpenCV from here.

Add emgucv-windows-\bin\x86 to PATH of your Environment Variables.

Open Visual Studio and create new C# project.java2

Then in the Solution Explorer, right click on References -> Add References.

java2

Click Browse and select Emgu.CV.dllEmgu.Util.dll, and Emgu.CV.UI.dll files in the bin folder as shown below.java2

Now, right click on your solution file and add an existing item

java2

Browse to your opencv build-> bin folder and select all the dll files shown below. Click add.

java2

Lastly select all the added dlls in the solution explorer and in the properties section, select Always copy as shown below.

java2

In the code, include the following


 

 

Leave a Comment

Your email address will not be published. Required fields are marked *