Computer >> Computer tutorials >  >> Programming >> Java

How to setup OpenCV Java with eclipse?


To setup JavaFx in eclipse, first of all, make sure that you have installed eclipse and Java in your system successfully.

Maven dependency

To set up JavaFX environment using maven dependency, create a Java project in eclipse convert it into a maven project as shown below −

How to setup OpenCV Java with eclipse?

Then in the pom.xml file add the following JavaFX dependency and refresh the project.

<dependency>
   <groupId>org.bytedeco</groupId>
   <artifactId>opencv</artifactId>
   <version>4.1.0-1.5.1</version>
</dependency>

If you observe the Maven Dependencies directory you can find the installed Jar files as shown below −

How to setup OpenCV Java with eclipse?

Adding required Jar files manually

You can also add the required JAR files manually, to do so

  • Visit the OpenCV home page and click on the Releases link.

  • You will be redirected to the Releases page. This contains various releases (versions and platforms) chose the desired release and download it.

  • Now, right click on the OpenCV project created above and, open the Java Build path window as shown below −

How to setup OpenCV Java with eclipse?

In the Java Build Path window, in the libraries tab click on the Add External JARs… button and add all the JAR file from the downloaded folder. If you have downloaded the Windows version, you can find the JAR file in the path build/java in the downloaded directory.

How to setup OpenCV Java with eclipse?

Finally, click on Apply and Close button then, you can observe the downloaded JAR files in the Referenced Libraries directory of the project.