OpenCV - Environment
OpenCV - Environment
In this chapter, you will learn how to install OpenCV and configure its environment in your system.
First of all, you need to download OpenCV on your system. Follow the steps below.
Step 1 - Open the OpenCV home page by clicking on the following link: http: //opencv.org/ " By clicking, you will see its home page as shown below -below.
Step 2 - Now click on the Downloads link highlighted in the screenshot. 'screen above. By clicking you will be taken to the OpenCV download page.
Step 3 - By clicking on the link highlighted in the screenshot shown below above it a file named opencv-3.1.0.exe will be downloaded. Extract this file to generate an opencv folder in your system as shown in the screenshot next.
Step 4 - Open the folder OpenCV → build → java . Here you will find the OpenCV jar file named opencv-310.jar . Save this file in a separate folder for later use.
After downloading the required JAR files, you need to integrate these JAR files into your Eclipse environment. You can do this by setting the build path on these JAR files and using pom.
Setting the build path
Here are the steps to set up OpenCV in Eclipse -
Step 1 - Make sure you have Eclipse installed in your system. Otherwise, download and install Eclipse in your system.
Step 2 - Open Eclipse, click on File, New and open a new project as shown in the following screenshot.
Step 3 - By selecting the project, you will get the New Project wizard. In this wizard, select the Java project and continue by clicking on the Next button, as shown inin the following screenshot.
Step 4 - Continuing, you will be taken to the New Java Project Wizard . Create a new project and click Next as shown in the following screenshot.
Step 5 - After creating a new project, right click on it. Select Build Path and click on Configure Build Path… as shown in the following screenshot.
Step 6 - By clicking on Build Path , you will be directed to the Java Build Path Wizard . Click on the Add External JAR Files button, as shown in the following screenshot.
Step 7 - Select the path where you saved the file opencv-310. jar .
Step 8 - By clicking on the Open button in The screenshot above, these files will be added to your library.
Step 9 - By clicking OK , you will successfully add the required JAR files to the current project and you can check these libraries added by expanding the referenced libraries.
Definition of library pathes natives
In addition to JAR files, you must set the path to native libraries (DLL files) of OpenCV.
Location of DLL files - Open the OpenCV installation folder and go to the build subfolder → java . Here you will find the two folders x64 (64 bit) and x86 (32 bit) which contain the OpenCV dll files.
Open the folder corresponding to your operating system, then you can see the dll file , as shown in the following screenshot.
Now also set the path to this file by following the steps below -
Step 1 - Again open the JavaBuildPath window. Here you can observe the added JAR file and the System JRE Library .
Step 2 - In expanding it, you will get the system libraries and the native location library , as shown in the following screenshot.
Step 3 - Double click on Location of native library . Here you can see the con windowfiguration of the native library folder as shown below.
on the External folder… button and select the location of the dll file in your system.