Bye-bye FAST!

FAST detector has been replaced with fancier Harris,
so no need to keep FAST library in the sources now.
This commit is contained in:
Sergey Sharybin 2014-02-06 18:13:12 +06:00
parent 9c587ae8a0
commit 5cbddd4ca4
16 changed files with 26 additions and 17950 deletions

View File

@ -40,6 +40,7 @@ if(WITH_LIBMV)
-DWITH_LIBMV
-DWITH_LIBMV_GUARDED_ALLOC
-DGOOGLE_GLOG_DLL_DECL=
-DLIBMV_NO_FAST_DETECTOR=
)
list(APPEND INC
@ -86,12 +87,6 @@ if(WITH_LIBMV)
libmv/tracking/track_region.cc
libmv/tracking/trklt_region_tracker.cc
third_party/fast/fast_10.c
third_party/fast/fast_11.c
third_party/fast/fast_12.c
third_party/fast/fast_9.c
third_party/fast/fast.c
third_party/fast/nonmax.c
third_party/gflags/gflags.cc
third_party/gflags/gflags_completions.cc
third_party/gflags/gflags_reporting.cc
@ -145,7 +140,6 @@ if(WITH_LIBMV)
libmv/tracking/track_region.h
libmv/tracking/trklt_region_tracker.h
third_party/fast/fast.h
third_party/gflags/config.h
third_party/gflags/gflags/gflags_completions.h
third_party/gflags/gflags/gflags_declare.h

View File

@ -1,3 +1,14 @@
commit b1381540305d69c702eb2f051bd543fb5c1c3e2c
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Thu Feb 6 18:01:58 2014 +0600
Made FAST detector optional
This way it's possible to bundle Libmv sources subset
to applications which doesn't need FAST detector.
Mainly this is done for Blender integration.
commit da4607f010bca0b3532cd4444afbb10bc774fc32
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Tue Jan 28 18:32:39 2014 +0600
@ -680,21 +691,3 @@ Date: Sun Apr 7 21:53:23 2013 +0600
usage pipeline. Anyway, deprecation shall not
happen spontaneously as a part of other changes.
And for sure shall not break anything.
commit c9eb9d36bb1ca5d3037ce66633d812a224f77958
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Sat Apr 6 20:49:05 2013 +0600
Revert "Change libmv's bilinear sampling to assume the same"
Revert changes to bilinear sampler which were originally
aimed to match blender's pixel center (where integer coord
is a left-bottom corner, x.5 coords are centers.
The reason of revert is changing this assumption in only
sampler didn't work well and lead to wrong results of
BlurredImageAndDerivativesChannels for example.
Discovered when was doing unit-tests for brute region tracker.
This reverts commit daa354c0735b954b0cd7725626e9a3d67416d46b.

View File

@ -16,6 +16,7 @@ if env['WITH_BF_LIBMV']:
defs.append('GOOGLE_GLOG_DLL_DECL=')
defs.append('WITH_LIBMV')
defs.append('WITH_LIBMV_GUARDED_ALLOC')
defs.append('LIBMV_NO_FAST_DETECTOR')
src = env.Glob("libmv-capi.cc")
src += env.Glob('libmv/image/*.cc')
@ -23,7 +24,6 @@ if env['WITH_BF_LIBMV']:
src += env.Glob('libmv/numeric/*.cc')
src += env.Glob('libmv/simple_pipeline/*.cc')
src += env.Glob('libmv/tracking/*.cc')
src += env.Glob('third_party/fast/*.c')
src += env.Glob('third_party/gflags/*.cc')
incs += ' ../Eigen3 third_party/ceres/include ../../intern/guardedalloc'

View File

@ -128,6 +128,7 @@ if(WITH_LIBMV)
-DWITH_LIBMV
-DWITH_LIBMV_GUARDED_ALLOC
-DGOOGLE_GLOG_DLL_DECL=
-DLIBMV_NO_FAST_DETECTOR=
)
list(APPEND INC
@ -231,6 +232,7 @@ if env['WITH_BF_LIBMV']:
defs.append('GOOGLE_GLOG_DLL_DECL=')
defs.append('WITH_LIBMV')
defs.append('WITH_LIBMV_GUARDED_ALLOC')
defs.append('LIBMV_NO_FAST_DETECTOR')
src = env.Glob("libmv-capi.cc")
$src

View File

@ -76,16 +76,6 @@ libmv/tracking/track_region.cc
libmv/tracking/track_region.h
libmv/tracking/trklt_region_tracker.cc
libmv/tracking/trklt_region_tracker.h
third_party/fast/fast_10.c
third_party/fast/fast_11.c
third_party/fast/fast_12.c
third_party/fast/fast_9.c
third_party/fast/fast.c
third_party/fast/fast.h
third_party/fast/LICENSE
third_party/fast/nonmax.c
third_party/fast/README
third_party/fast/README.libmv
third_party/gflags/AUTHORS
third_party/gflags/ChangeLog
third_party/gflags/config.h

View File

@ -25,7 +25,6 @@
#include <stdlib.h>
#include <memory.h>
#include <queue>
#include <third_party/fast/fast.h>
#include "libmv/base/scoped_ptr.h"
#include "libmv/image/array_nd.h"
@ -34,6 +33,10 @@
#include "libmv/logging/logging.h"
#include "libmv/simple_pipeline/detect.h"
#ifndef LIBMV_NO_FAST_DETECTOR
# include <third_party/fast/fast.h>
#endif
#ifdef __SSE2__
# include <emmintrin.h>
#endif
@ -92,6 +95,7 @@ void FilterFeaturesByDistance(const vector<Feature> &all_features,
void DetectFAST(const FloatImage &grayscale_image,
const DetectOptions &options,
vector<Feature> *detected_features) {
#ifndef LIBMV_NO_FAST_DETECTOR
const int min_distance = options.min_distance;
const int min_trackness = options.fast_min_trackness;
const int margin = options.margin;
@ -140,6 +144,12 @@ void DetectFAST(const FloatImage &grayscale_image,
}
free(scores);
free(nonmax);
#else
(void) grayscale_image; // Ignored.
(void) options; // Ignored.
(void) detected_features; // Ignored.
LOG(FATAL) << "FAST detector is disabled in this build.";
#endif
}
#ifdef __SSE2__

View File

@ -1,30 +0,0 @@
Copyright (c) 2006, 2008 Edward Rosten
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
*Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
*Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
*Neither the name of the University of Cambridge nor the names of
its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,31 +0,0 @@
FAST feature detectors in C Version 2.0
---------------------------------------
The files are valid C and C++ code, and have no special requirements for
compiling, and they do not depend on any libraries. Just compile them along with
the rest of your project.
To use the functions, #include "fast.h"
The corner detectors have the following prototype (where X is 9, 10, 11 or 12):
xy* fastX_detect_nonmax(const unsigned char * data, int xsize, int ysize, int stride, int threshold, int* numcorners)
Where xy is the following simple struct typedef:
typedef struct
{
int x, y;
} xy;
The image is passed in as a block of data and dimensions, and the list of
corners is returned as an array of xy structs, and an integer (numcorners)
with the number of corners returned. The data can be deallocated with free().
Nonmaximal suppression is performed on the corners. Note that the stride
is the number of bytes between rows. If your image has no padding, then this
is the same as xsize.
The detection, scoring and nonmaximal suppression are available as individual
functions. To see how to use the individual functions, see fast.c

View File

@ -1,9 +0,0 @@
Project: FAST (FAST Corner Detection)
URL: http://mi.eng.cam.ac.uk/~er258/work/fast-C-src/
License: BSD
Upstream version: 2.1, released 12-Jan-2009
Local modifications:
- Created CMakeLists.txt for CMake build.
- Update CMakeLists to be sure that the library is a compatible with C++ linkage.
- Update CMakeLists to not include fast.h to compile fast library with VS2005.

View File

@ -1,71 +0,0 @@
#include <stdlib.h>
#include "fast.h"
xy* fast9_detect_nonmax(const byte* im, int xsize, int ysize, int stride, int b, int* ret_num_corners)
{
xy* corners;
int num_corners;
int* scores;
xy* nonmax;
corners = fast9_detect(im, xsize, ysize, stride, b, &num_corners);
scores = fast9_score(im, stride, corners, num_corners, b);
nonmax = nonmax_suppression(corners, scores, num_corners, ret_num_corners);
free(corners);
free(scores);
return nonmax;
}
xy* fast10_detect_nonmax(const byte* im, int xsize, int ysize, int stride, int b, int* ret_num_corners)
{
xy* corners;
int num_corners;
int* scores;
xy* nonmax;
corners = fast10_detect(im, xsize, ysize, stride, b, &num_corners);
scores = fast10_score(im, stride, corners, num_corners, b);
nonmax = nonmax_suppression(corners, scores, num_corners, ret_num_corners);
free(corners);
free(scores);
return nonmax;
}
xy* fast11_detect_nonmax(const byte* im, int xsize, int ysize, int stride, int b, int* ret_num_corners)
{
xy* corners;
int num_corners;
int* scores;
xy* nonmax;
corners = fast11_detect(im, xsize, ysize, stride, b, &num_corners);
scores = fast11_score(im, stride, corners, num_corners, b);
nonmax = nonmax_suppression(corners, scores, num_corners, ret_num_corners);
free(corners);
free(scores);
return nonmax;
}
xy* fast12_detect_nonmax(const byte* im, int xsize, int ysize, int stride, int b, int* ret_num_corners)
{
xy* corners;
int num_corners;
int* scores;
xy* nonmax;
corners = fast12_detect(im, xsize, ysize, stride, b, &num_corners);
scores = fast12_score(im, stride, corners, num_corners, b);
nonmax = nonmax_suppression(corners, scores, num_corners, ret_num_corners);
free(corners);
free(scores);
return nonmax;
}

View File

@ -1,39 +0,0 @@
#ifndef FAST_H
#define FAST_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct { int x, y; } xy;
typedef unsigned char byte;
int fast9_corner_score(const byte* p, const int pixel[], int bstart);
int fast10_corner_score(const byte* p, const int pixel[], int bstart);
int fast11_corner_score(const byte* p, const int pixel[], int bstart);
int fast12_corner_score(const byte* p, const int pixel[], int bstart);
xy* fast9_detect(const byte* im, int xsize, int ysize, int stride, int b, int* ret_num_corners);
xy* fast10_detect(const byte* im, int xsize, int ysize, int stride, int b, int* ret_num_corners);
xy* fast11_detect(const byte* im, int xsize, int ysize, int stride, int b, int* ret_num_corners);
xy* fast12_detect(const byte* im, int xsize, int ysize, int stride, int b, int* ret_num_corners);
int* fast9_score(const byte* i, int stride, xy* corners, int num_corners, int b);
int* fast10_score(const byte* i, int stride, xy* corners, int num_corners, int b);
int* fast11_score(const byte* i, int stride, xy* corners, int num_corners, int b);
int* fast12_score(const byte* i, int stride, xy* corners, int num_corners, int b);
xy* fast9_detect_nonmax(const byte* im, int xsize, int ysize, int stride, int b, int* ret_num_corners);
xy* fast10_detect_nonmax(const byte* im, int xsize, int ysize, int stride, int b, int* ret_num_corners);
xy* fast11_detect_nonmax(const byte* im, int xsize, int ysize, int stride, int b, int* ret_num_corners);
xy* fast12_detect_nonmax(const byte* im, int xsize, int ysize, int stride, int b, int* ret_num_corners);
xy* nonmax_suppression(const xy* corners, const int* scores, int num_corners, int* ret_num_nonmax);
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,117 +0,0 @@
#include <stdlib.h>
#include "fast.h"
#define Compare(X, Y) ((X)>=(Y))
xy* nonmax_suppression(const xy* corners, const int* scores, int num_corners, int* ret_num_nonmax)
{
int num_nonmax=0;
int last_row;
int* row_start;
int i, j;
xy* ret_nonmax;
const int sz = (int)num_corners;
/*Point above points (roughly) to the pixel above the one of interest, if there
is a feature there.*/
int point_above = 0;
int point_below = 0;
if(num_corners < 1)
{
*ret_num_nonmax = 0;
return 0;
}
ret_nonmax = (xy*)malloc(num_corners * sizeof(xy));
/* Find where each row begins
(the corners are output in raster scan order). A beginning of -1 signifies
that there are no corners on that row. */
last_row = corners[num_corners-1].y;
row_start = (int*)malloc((last_row+1)*sizeof(int));
for(i=0; i < last_row+1; i++)
row_start[i] = -1;
{
int prev_row = -1;
for(i=0; i< num_corners; i++)
if(corners[i].y != prev_row)
{
row_start[corners[i].y] = i;
prev_row = corners[i].y;
}
}
for(i=0; i < sz; i++)
{
int score = scores[i];
xy pos = corners[i];
/*Check left */
if(i > 0)
if(corners[i-1].x == pos.x-1 && corners[i-1].y == pos.y && Compare(scores[i-1], score))
continue;
/*Check right*/
if(i < (sz - 1))
if(corners[i+1].x == pos.x+1 && corners[i+1].y == pos.y && Compare(scores[i+1], score))
continue;
/*Check above (if there is a valid row above)*/
if(pos.y != 0 && row_start[pos.y - 1] != -1)
{
/*Make sure that current point_above is one
row above.*/
if(corners[point_above].y < pos.y - 1)
point_above = row_start[pos.y-1];
/*Make point_above point to the first of the pixels above the current point,
if it exists.*/
for(; corners[point_above].y < pos.y && corners[point_above].x < pos.x - 1; point_above++)
{}
for(j=point_above; corners[j].y < pos.y && corners[j].x <= pos.x + 1; j++)
{
int x = corners[j].x;
if( (x == pos.x - 1 || x ==pos.x || x == pos.x+1) && Compare(scores[j], score))
goto cont;
}
}
/*Check below (if there is anything below)*/
if(pos.y != last_row && row_start[pos.y + 1] != -1 && point_below < sz) /*Nothing below*/
{
if(corners[point_below].y < pos.y + 1)
point_below = row_start[pos.y+1];
/* Make point below point to one of the pixels belowthe current point, if it
exists.*/
for(; point_below < sz && corners[point_below].y == pos.y+1 && corners[point_below].x < pos.x - 1; point_below++)
{}
for(j=point_below; j < sz && corners[j].y == pos.y+1 && corners[j].x <= pos.x + 1; j++)
{
int x = corners[j].x;
if( (x == pos.x - 1 || x ==pos.x || x == pos.x+1) && Compare(scores[j],score))
goto cont;
}
}
ret_nonmax[num_nonmax++] = corners[i];
cont:
;
}
free(row_start);
*ret_num_nonmax = num_nonmax;
return ret_nonmax;
}