Skip to content

Latest commit

 

History

History
115 lines (73 loc) · 3.32 KB

README.md

File metadata and controls

115 lines (73 loc) · 3.32 KB

Circle CI

opensurf-java

Simple JNI Wrapper for Chris Evans OpenSURF.
(C. Evans, Research Into Robust Visual Features, MSc University of Bristol, 2008.)
This library is distributed under the GNU GPL.

Supports detection of SURF keypoints and computation of descriptors.

The easy way - use Docker

  • Get Docker for your platform.

If you just want to use OpenSURF in Java you can get a pre-built image. It includes a working copy of OpenSURF and OpenCV 2.4.11 with Oracle Java 8 and Gradle running on Ubuntu Trusty.

  • Pull it from the repo

    docker pull stonerworx/opensurf-java
    
    
  • Or use it in your Dockerfile

    FROM stonerworx/opensurf-java
    
    
  • The OpenSURF library is located in /home/javalibs/opensurf-1.0.jar

  • The OpenCV library is located in /home/javalibs/opencv-2411.jar

If you'd like to contribute you can use the Dockerfile to run tests:

  • Build the Dockerfile

    docker build -t opensurf-java .
  • Run the test

    docker run opensurf-java gradle test

The slightly more difficult way

Requires OpenCV to be installed.

  • Install OpenCV (I recommend using MacPorts)

    port install opencv +java
  • Copy opencv-2411.jar in /opt/local/share/OpenCV/java to libs/

Mac OS X

  • Copy the libopencv_java2411.dylib file in /opt/local/share/OpenCV/java to your java.library.path

  • Build the native library (Use the makefile.mac - You may need to edit some paths in the Makefile)

    cd jni
    make
  • Copy the libopensurf_java.dylib file in libs/native to your java.library.path

  • Build the project

    gradle build
  • Add opensurf-1.0.jar as a dependency in your project

Android (Android Studio)

Requires the Android NDK to build the libraries.

Usage

import com.multicorn.opensurf.Opensurf;

import org.opencv.core.Mat;
import org.opencv.core.MatOfKeyPoint;
import org.opencv.highgui.Highgui;

MatOfKeyPoint keyPoints;
Mat descriptors;

/*
 * detect, then describe
*/

Mat imageMat = Highgui.imread(getClass().getResource("/test.jpg").getPath());

keyPoints = Opensurf.detect(imageMat, 5, 4, 2, 0.0004f);

descriptors = Opensurf.describe(imageMat, keyPoints, true);

/*
 * detect & describe
*/

keyPoints = new MatOfKeyPoint();
descriptors = new Mat();

Opensurf.detectDescribe(imageMat, keyPoints, descriptors, 5, 4, 2, 0.0004f, true);