Skip to content

Commit

Permalink
Commited original SURF V1.0.9 to Github
Browse files Browse the repository at this point in the history
  • Loading branch information
herbertbay committed May 19, 2016
0 parents commit 495f89a
Show file tree
Hide file tree
Showing 19 changed files with 2,314 additions and 0 deletions.
31 changes: 31 additions & 0 deletions CHANGES
@@ -0,0 +1,31 @@
V1.0.9
------
- Minor bugfix in interest point detection
- Windows version updated as well

V1.0.8
------
- Fixed PGM loading routine to work with all PGM file varieties
- Added -nl option to output descriptor without Laplacian
- P1 interest point loading option: too small scales could result in NaN for descriptor
- Fixed rare segmentation fault
- Included sample matching application to demonstrate use of Laplacian
- Sample matching also provides image output for visual testing of detection/matching result
- Compiler changed to v4.0.2 (problems with Pentium 3 compatibility of 4.0.0)

V1.0.7
------
- Fixed SIGSEGV occuring for some pictures
- Changed compiler to g++ v4.0.0. To compile against library, same compiled has to be used.
- Windows DLL available as well

V1.0.6
------
- Subpixel offset was not rotated w.r.t. dominant direction---fixed (thanks to Geert Willems)
- Surf is now a shared library, surflib.h provides an interface to the library
- Option to load interest points, verbose output flag (thanks to Bastian Leibe)
Internal:
- Makefile updated to actually react to changes in source code
- Changed data structure for interest points to vector<>, removed unnecessary indirections
- Removed unnecessary allocation/deallocation in many places
- Slight speed up (about 10%)
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
LICENSE CONDITIONS

Copyright (2006): ETH Zurich, Switzerland
Katholieke Universiteit Leuven, Belgium
All rights reserved.

For details, see the paper:
Herbert Bay, Tinne Tuytelaars, Luc Van Gool,
"SURF: Speeded Up Robust Features"
Proceedings of the ninth European Conference on Computer Vision, May 2006

Permission to use, copy, modify, and distribute this software and
its documentation for educational, research, and non-commercial
purposes, without fee and without a signed licensing agreement, is
hereby granted, provided that the above copyright notice and this
paragraph appear in all copies modifications, and distributions.

Any commercial use or any redistribution of this software
requires a license from one of the above mentioned establishments.

For further details, contact Andreas Ess (aess@vision.ee.ethz.ch).
44 changes: 44 additions & 0 deletions Makefile
@@ -0,0 +1,44 @@

# ------------------ Compilation options ------------------------

# Loads math library.
LIBS = -lm
GET = get
CFLAGS = -Wall -O3 -DNO_DEBUG -march=pentium4 -mfpmath=sse -mmmx -msse -msse2 -msse3 -ansi
DEPEND= makedepend $(CFLAGS)

CC = g++-4.0.2
CXX = g++-4.0.2

# --------------------- Code modules ----------------------------

# Source files
SRCS = main.cpp imload.cpp os_mapping.cpp
# Object files
OBJ = main.o imload.o os_mapping.o
# Definitions
DEFS = image.h fasthessian.h ipoint.h surf.h imload.h

# ------------------------ Rules --------------------------------
#$(SRCS):
# $(GET) $@

# Link against static library
surf.ln: ${OBJ} libSurf.so
${CC} -o $@ ${CFLAGS} main.o imload.o os_mapping.o -static libSurf.a ${LIBS}

# Small matching demo application

match.ln: match.cpp imload.o
${CC} -o $@ ${CFLAGS} imload.o match.cpp -static libSurf.a -lm

# To link against a shared library, use
#surf.ln: ${OBJ} libSurf.so
# ${CC} -o $@ ${CFLAGS} main.o imload.o -L. -lSurf ${LIBS}
# Note to set LD_LIBRARY_PATH environment variable before running surf.ln

clean:
-rm *.o surf.ln match.ln

#depend: $(SRCS)
# $(DEPEND) $(SRCS)
52 changes: 52 additions & 0 deletions README.md
@@ -0,0 +1,52 @@
#SURF - Speeded Up Robust Features

##Requirements

The library has been compiled using g++, version 4.0.2, for usage on
a machine Pentium 4 or better. To use the library in your program,
you need to use the same compiler version.

If you require the library to be compiled using another compiler, or
another platform (such as Athlon XP), please contact us.

##Usage

Execute surf.ln without any argument in order to get more
information concerning the usage and possible parameters.

Use "make match.ln" to compile the matching demo application.

##Data Format

The output format of SURF is as follows:

(1 + length of descriptor)
number of points
x y a b c l des
x y a b c l des
...

x, y = position of interest point
a, b, c = [a b; b c] entries of second moment matrix.
SURF only has circular regions, hence b = 0; a = c -> radius = 1 / a^2
l = sign of laplacian (-1 or 1)
des = descriptor vector itself

##Data Input Format

If only the SURF descriptor should be computed, the -p1 command can
be used. As an argument, it takes a file of the following format:

(dummy byte)
number of points
x y a b c
x y a b c

Where, as above, [a b; b c] forms the second moment matrix. Note that
SURF uses circular regions. Hence, a = c and b = 0.

##Licensing conditions

This software is being made available for research purposes only. It
is necessary to obtain a license (see LICENSE file) for commercial
applications.
113 changes: 113 additions & 0 deletions fasthessian.h
@@ -0,0 +1,113 @@
/*
* Speeded-Up Robust Features (SURF)
* http://people.ee.ethz.ch/~surf
*
* Authors: Herbert Bay, Andreas Ess, Geert Willems
* Windows port by Stefan Saur
*
* Copyright (2006): ETH Zurich, Switzerland
* Katholieke Universiteit Leuven, Belgium
* All rights reserved.
*
* For details, see the paper:
* Herbert Bay, Tinne Tuytelaars, Luc Van Gool,
* "SURF: Speeded Up Robust Features"
* Proceedings of the ninth European Conference on Computer Vision, May 2006
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for educational, research, and non-commercial
* purposes, without fee and without a signed licensing agreement, is
* hereby granted, provided that the above copyright notice and this
* paragraph appear in all copies modifications, and distributions.
*
* Any commercial use or any redistribution of this software
* requires a license from one of the above mentioned establishments.
*
* For further details, contact Andreas Ess (aess@vision.ee.ethz.ch).
*/

#ifndef __FASTHESSIAN_H
#define __FASTHESSIAN_H

#include <vector>

namespace surf {

class Ipoint;
class Image;

class FastHessian {
public:
//! Destructor
~FastHessian();

//! Constructor with parameters
FastHessian(Image *im, std::vector< Ipoint >& ip, double thres = 0.2, bool doub = false,
short int initMasksize = 9, short int samplingStep = 2,
short int octaves = 4);

//! Pass the integral image
void setIimage( Image *iim );

//! Detect the interest Points, write into ipts
void getInterestPoints();

//! Create a new ipoint at location (x, y), at a certain scale
//! and corner response strength
void makeIpoint(double x, double y, double scale, double strength=0);

protected:
//! Allocate scale layers for one octave
void allocateOctave();

//! Fast non-maximum-suppression
void findMaximum(int *borders, int o, int octave);
void interpFeature(int s, int row, int col, Image *map,
int o, int octave, int movesRemain,
int *borders);
int fitQuadrat(int s, int r, int c, double &res);

private:
//! Integral image
Image *_Iimage;

//! Octaves
Image **_scaleLevel;

//! Vector of variables
int _vas[9];

//! Threshold for interest point detection
double _threshold;

//! Indicates whether the image size was doubled or not
//! default is false
bool _doubled;

//! Reference to vector of interest points passed from outside
std::vector< Ipoint >& _ipts;

//! Initial lobe size for the second derivative in one direction
//! default is 3
short int _initLobe;

//! Number scales
short int _maxScales;

//! Number octaves
short int _maxOctaves;

//! The sampling step
short int _sampling;

//! Integral image dimensions
int _width;
int _height;

//! Result of fitting quadratic
double _offset[3];
};

}

#endif // FASTHESSIAN_H
115 changes: 115 additions & 0 deletions image.h
@@ -0,0 +1,115 @@
/*
* Speeded-Up Robust Features (SURF)
* http://people.ee.ethz.ch/~surf
*
* Authors: Herbert Bay, Andreas Ess, Geert Willems
* Windows port by Stefan Saur
*
* Copyright (2006): ETH Zurich, Switzerland
* Katholieke Universiteit Leuven, Belgium
* All rights reserved.
*
* For details, see the paper:
* Herbert Bay, Tinne Tuytelaars, Luc Van Gool,
* "SURF: Speeded Up Robust Features"
* Proceedings of the ninth European Conference on Computer Vision, May 2006
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for educational, research, and non-commercial
* purposes, without fee and without a signed licensing agreement, is
* hereby granted, provided that the above copyright notice and this
* paragraph appear in all copies modifications, and distributions.
*
* Any commercial use or any redistribution of this software
* requires a license from one of the above mentioned establishments.
*
* For further details, contact Andreas Ess (aess@vision.ee.ethz.ch).
*/

#ifndef __IMAGE_H
#define __IMAGE_H

namespace surf {

class Image {

public:
//! Constructor
Image(const int w, const int h);

//! Destructor
~Image();

//! Constructor from existing double array
Image(double **pixels, int w, int h);

//! constructor for integral image
Image(Image *im, bool doubleImSize=false);

//! Pass a single frame to the (pre-initialized) structure
void setFrame(unsigned char *im);
void setFrame(Image *im);

//! Divide the image size by two
Image *HalfImage();

//! Get Hessian response at a certain point
double getHessian(int *x);

//! Get Trace of the Hessian
int getTrace(int *x);

//! Get the pointer to the image pixels
double **getPixels() const;

//! Get the pixel intensity at location (\a x, \a y)
double getPix(const int x, const int y) const {
return _pixels[y][x];
}

//! Overload of getPix returning the reference
double &getPix(const int x, const int y) {
return _pixels[y][x];
}

//! Set the Pixel at location (\a x, \a y) to the value "\a val"
void setPix(const int x, const int y, const double val) {
_pixels[y][x] = val;
}

//! get width
int getWidth();

//! get height
int getHeight();

//! set width
void setWidth(int wi);

//! set height
void setHeight(int hi);

protected:
//! Allocate 2D array of image pixels
void allocPixels(int w, int h);

private:
//! Actual image buffer
double *_buf;

//! 2D array of image pixels
double **_pixels;

//! Image height and width
int _height, _width;

//! Original image height
int _orihi;

//! Flag if this image is just a reference
bool _ref;
};

}

#endif //IMAGE_H

0 comments on commit 495f89a

Please sign in to comment.