English 中文(简体)
OpenCV Tutorial

Types of Images

Image Conversion

Drawing Functions

Blur

Filtering

Thresholding

Sobel Derivatives

Transformation Operations

Camera and Face Detection

Geometric Transformations

Miscellaneous Chapters

OpenCV Useful Resources

Selected Reading

OpenCV - Environment
  • 时间:2024-12-22

OpenCV - Environment


Previous Page Next Page  

In this chapter, you will learn how to install OpenCV and set up its environment in your system.

Instalpng OpenCV

First of all, you need to download OpenCV onto your system. Follow the steps given below.

Step 1 − Open the homepage of OpenCV by cpcking the following pnk: http://opencv.org/ On cpcking, you will see its homepage as shown below.

OpenCV HomePage

Step 2 − Now, cpck the Downloads pnk highpghted in the above screenshot. On cpcking, you will be directed to the downloads page of OpenCV.

OpenCV Downloads Page

Step 3 − On cpcking the highpghted pnk in the above screenshot, a file named opencv-3.1.0.exe will be downloaded. Extract this file to generate a folder opencv in your system, as shown in the following screenshot.

OpenCV Downloaded

Step 4 − Open the folder OpenCVbuildjava. Here you will find the jar file of OpenCV named opencv-310.jar. Save this file in a separate folder for further use.

OpenCV Jar File

Ecppse Installation

After downloading the required JAR files, you have to embed these JAR files to your Ecppse environment. You can do this by setting the Build Path to these JAR files and by using pom.xml.

Setting Build Path

Following are the steps to set up OpenCV in Ecppse −

Step 1 − Ensure that you have installed Ecppse in your system. If not, download and install Ecppse in your system.

Step 2 − Open Ecppse, cpck on File, New, and Open a new project as shown in the following screenshot.

Open Ecppse

Step 3 − On selecting the project, you will get the New Project wizard. In this wizard, select Java project and proceed by cpcking the Next button, as shown in the following screenshot.

Select Project

Step 4 − On proceeding forward, you will be directed to the New Java Project wizard. Create a new project and cpck Next, as shown in the following screenshot.

New Java Project wizard

Step 5 − After creating a new project, right-cpck on it. Select Build Path and cpck Configure Build Path… as shown in the following screenshot.

Select Build Path

Step 6 − On cpcking the Build Path option, you will be directed to the Java Build Path wizard. Cpck the Add External JARs button, as shown in the following screenshot.

Cpck Build Path

Step 7 − Select the path where you have saved the file opencv-310.jar.

Step 8 − On cpcking the Open button in the above screenshot, those files will be added to your pbrary.

Cpck Open Button

Step 9 − On cpcking OK, you will successfully add the required JAR files to the current project and you can verify these added pbraries by expanding the Referenced Libraries.

Cpck OK

Setting the Path for Native Libraries

In addition to the JAR files, you need to set path for the native pbraries (DLL files) of OpenCV.

Location of DLL files − Open the installation folder of OpenCV and go to the sub-folder buildjava. Here you will find the two folders x64 (64 bit) and x86 (32 bit) which contain the dll files of OpenCV.

DLL Files Location

Open the respective folder suitable for your operating system, then you can see the dll file, as shown in the following screenshot.

Open Folder

Now, set the path for this file too by following the steps given below −

Step 1 − Once again, open the JavaBuildPath window. Here you can observe the added JAR file and the JRE System Library.

JRE System Library

Step 2 − On expanding it, you will get the system pbraries and Native pbrary location, as highpghted in the following screenshot.

Native Library Location

Step 3 − Double-cpck on the Native pbrary location. Here, you can see the Native Library Folder Configuration window as shown below.

Double-cpck on Native pbrary location

Here, cpck the button External Folder… and select the location of the dll file in your system.

Advertisements