Chapter 3. Applying Image Effects

For this chapter, our goal is to add several image filters to Second Sight. These filters rely on various OpenCV functions for manipulating matrices through splitting, merging, arithmetic operations, or applying lookup tables for complex functions. Certain filters also rely on a mathematics library called Apache Commons Math.

We need to add several files to our Eclipse project in order to create new types (that is, interfaces and classes) and to link to a new library, Apache Commons Math. The following are the new types that we want to create:

Create the appropriate packages and Java files under the src directory in the Package Explorer pane. (Right-click on the src directory and then choose New | Package, New | Interface, or New | Class from the context menu.)

Now, let's get the Apache Commons Math library. Download the latest version from http://commons.apache.org/proper/commons-math/download_math.cgi. Unzip the download file. Inside the unzipped folder, find a file with a name such as commons-math3-3.2.jar. (The version numbers may differ.) Copy this file into the libs folder of the Eclipse project.

After all the necessary files are added, your Package Explorer pane should look similar to the one in the following screenshot:

Adding files to the project