- OpenCV - GUI
- OpenCV - Writing an Image
- OpenCV - Reading Images
- OpenCV - Storing Images
- OpenCV - Environment
- OpenCV - Overview
- OpenCV - Home
Types of Images
Image Conversion
Drawing Functions
- OpenCV - Adding Text
- OpenCV - Drawing Arrowed Lines
- OpenCV - Drawing Convex Polylines
- OpenCV - Drawing Polylines
- OpenCV - Drawing an Ellipse
- OpenCV - Drawing a Rectangle
- OpenCV - Drawing a Line
- OpenCV - Drawing a Circle
Blur
Filtering
- OpenCV - Image Pyramids
- OpenCV - Morphological Operations
- OpenCV - Erosion
- OpenCV - Dilation
- OpenCV - Filter2D
- OpenCV - SQRBox Filter
- OpenCV - Box Filter
- OpenCV - Bilateral Filter
Thresholding
Sobel Derivatives
Transformation Operations
Camera and Face Detection
Geometric Transformations
Miscellaneous Chapters
OpenCV Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
OpenCV - Environment
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:
On cpcking, you will see its homepage as shown below.![OpenCV HomePage](/opencv/images/opencv_homepage.jpg)
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](/opencv/images/opencv_downloads_page.jpg)
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](/opencv/images/opencv_downloaded.jpg)
Step 4 − Open the folder OpenCV → build → java. 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](/opencv/images/opencv_jar_file.jpg)
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](/opencv/images/open_ecppse.jpg)
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](/opencv/images/select_project.jpg)
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](/opencv/images/new_java_project_wizard.jpg)
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](/opencv/images/select_build_path.jpg)
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](/opencv/images/cpck_build_path.jpg)
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](/opencv/images/cpck_open_button.jpg)
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](/opencv/images/cpck_ok.jpg)
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 build → java. Here you will find the two folders x64 (64 bit) and x86 (32 bit) which contain the dll files of OpenCV.
![DLL Files Location](/opencv/images/dll_files_location.jpg)
Open the respective folder suitable for your operating system, then you can see the dll file, as shown in the following screenshot.
![Open Folder](/opencv/images/open_folder.jpg)
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](/opencv/images/jre_system_pbrary.jpg)
Step 2 − On expanding it, you will get the system pbraries and Native pbrary location, as highpghted in the following screenshot.
![Native Library Location](/opencv/images/native_pbrary_location.jpg)
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](/opencv/images/double_cpck_native_pbrary_location.jpg)
Here, cpck the button External Folder… and select the location of the dll file in your system.
Advertisements