Skip to content

Tutorial 1 Java OpenCV 5 minute setup

Daniel Lélis Baggio edited this page Aug 26, 2015 · 13 revisions

This tutorial will show you how to setup OpenCV for Java in 5 minutes.

1- Download and install Maven:

Maven is a project management tool that simplifies the process of retrieving dependencies for your Java project. It allows you to automatically download them from the internet using a preconfigured xml file that describes your project. In order to download it, go to https://maven.apache.org/download.cgi and look for a file named something like: apache-maven-3.3.3-bin.zip . Extract this file to a folder, let's say c:\users\your_name\Downloads\apache-maven-3.3.3-bin\ . In order to install it, follow instructions from: https://maven.apache.org/install.html . This is basically: "Adding to PATH: Add the unpacked distribution’s bin directory to your user PATH environment variable by opening up the system properties (WinKey + Pause), selecting the “Advanced” tab, and the “Environment Variables” button, then adding or selecting the PATH variable in the user variables with the value C:\Program Files\apache-maven-3.3.3\bin. The same dialog can be used to set JAVA_HOME to the location of your JDK, e.g. C:\Program Files\Java\jdk1.7.0_51". Check that Maven was correctly installed opening a new terminal and typing: mvn -v.

2- Get your starting pom.xml

There's a pom.xml available from https://github.com/JavaOpenCVBook/code/blob/master/chapter2/opencv-gui/pom.xml . Simply right-click the RAW button and save this in your computer. Remember to open it and change a couple details, like the groupId, the name of your project, and the version.


4.0.0 org.javaopencvbook opencv-gui jar 1.0-SNAPSHOT opencv-gui http://maven.apache.org


3- Package your project

Now it's time for Maven to do his job. In the command prompt, go to the place you saved your pom.xml file, and issue the following command:

mvn package

Clone this wiki locally