This project is an implementation of the SURF algorithm (Speeded-Up Robust Features), written entirely in Java. SURF is a computer vision technique used for detecting and describing local features in images. It is known for being faster than SIFT while still being robust to changes in scale, rotation, illumination, and noise [1].
The SURF algorithm is widely used in image matching, object recognition, image stitching, and 3D reconstruction. Its core steps are:
- Integral Image: Precomputed image representation that enables very fast area summation (constant time lookup).
- Hessian Matrix Detector: Uses determinant of Hessian to find blob-like keypoints in multiple scales.
- Keypoint Localization: Detects robust interest points in the image.
- Orientation Assignment (future work): Assigns a dominant direction to each keypoint, ensuring rotation invariance.
- Descriptor Generation (future work): Builds a descriptor vector around each keypoint for robust matching.
The goal of this implementation is to provide a pure Java version of SURF, for experimentation, study, and integration into other Java-based projects.
- Java 17 or newer;
- No external dependencies (pure Java, standard libraries only).
-
Clone this repository.
-
Place your input image (JPG format, grayscale recommended) into the
src/main/resourcesfolder. -
Example usage in Java:
public class Main {
public static void main(String[] args) throws IOException {
SURFBuilder builder = new SURFBuilder()
.setInputImage("lenna.jpg")
.setThreshold(0.0004f);
// Run the SURF pipeline
builder.generate("surf_output.jpg");
}
}- Output images are saved in the folder:
target/output/.
- Grayscale conversion and preprocessing (Gaussian smoothing).
- Hessian-based keypoint detection at a single scale.
- Export of keypoints for visualization or further processing.
- Multi-scale detection (scale-space representation using box filters).
- Orientation assignment (for rotation invariance).
- Descriptor extraction (for feature matching).
- Feature matching utilities between two images.
SURFBuilder.java— Main class to configure and run the SURF algorithm.HessianDetector.java— Computes the determinant of Hessian and extracts keypoints.KeyPoint.java— Immutable record representing a feature point.Main.java— Example entry point.
- Input/output images are handled in JPG format only.
- Input images are converted internally to grayscale.
- The implementation is a simplified SURF, intended for learning and experimentation.
The available source codes here are under the Apache License, version 2.0 (see the attached LICENSE file for more details). Any questions can be submitted to my email: [email protected].
[1] H. Bay, T. Tuytelaars, and L. Van Gool, "SURF: Speeded Up Robust Features", European Conference on Computer Vision, 2006.