Skip to content

Commit c846981

Browse files
committed
initial copy from 1.1
0 parents  commit c846981

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+7667
-0
lines changed

AUTHORS

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Authors of fern-demo
2+
--------------------
3+
Vincent Lepetit (vincent.lepetit@epfl.ch)
4+
Mustafa Ozuysal (mustafa.oezuysal@epfl.ch)
5+
Julien Pilet (julien.pilet@epfl.ch)

COPYING

+339
Large diffs are not rendered by default.

Makefile

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
VER=1.1
2+
3+
EXECUTABLE_1_NAME = ferns_demo
4+
SOURCES_1 = main mcv planar_pattern_detector planar_pattern_detector_builder \
5+
affine_transformation_range buffer_management pyr_yape06 homography06 homography_estimator \
6+
fine_gaussian_pyramid mcvGaussianSmoothing affine_image_generator06 fern_based_point_classifier \
7+
ferns template_matching_based_tracker cmphomo
8+
9+
HEADERS= affine_image_generator06.h affine_transformation_range.h buffer_management.h \
10+
cmphomo.h fern_based_point_classifier.h ferns.h fine_gaussian_pyramid.h \
11+
general.h homography06.h homography_estimator.h keypoint.h mcvGaussianSmoothing.h \
12+
mcv.h planar_pattern_detector_builder.h planar_pattern_detector.h pyr_yape06.h \
13+
template_matching_based_tracker.h
14+
15+
CC = g++
16+
LINK = g++
17+
18+
# DEBUG_OPTIM = -g
19+
DEBUG_OPTIM = -O3
20+
WARNINGS = -Wall -Wextra
21+
22+
OPENCV_INC = `pkg-config opencv --cflags`
23+
ALL_LIBS_INCLUDE = $(OPENCV_INC)
24+
25+
OPENCV_LIB = `pkg-config opencv --libs`
26+
27+
ALL_LIBS_LIB = $(OPENCV_LIB) -lz
28+
29+
CC_OPTIONS = $(WARNINGS) $(DEBUG_OPTIM) $(ALL_LIBS_INCLUDE)
30+
LINK_OPTIONS = $(ALL_LIBS_LIB)
31+
32+
33+
all: $(EXECUTABLE_1_NAME) $(EXECUTABLE_2_NAME)
34+
35+
SOURCES_1_CC = $(SOURCES_1:=.cc)
36+
SOURCES_1_OBJ = $(SOURCES_1:=.o)
37+
38+
SOURCES_2_CC = $(SOURCES_2:=.cc)
39+
SOURCES_2_OBJ = $(SOURCES_2:=.o)
40+
41+
$(EXECUTABLE_1_NAME): $(SOURCES_1_OBJ)
42+
$(LINK) $(SOURCES_1_OBJ) $(LINK_OPTIONS) -o $(EXECUTABLE_1_NAME)
43+
44+
$(EXECUTABLE_2_NAME): $(SOURCES_2_OBJ)
45+
$(LINK) $(SOURCES_2_OBJ) $(LINK_OPTIONS) -o $(EXECUTABLE_2_NAME)
46+
47+
.cc.o:
48+
$(CC) $(CC_OPTIONS) -c $*.cc
49+
50+
dep: depend.inc
51+
depend.inc:
52+
g++ -MM $(ALL_LIBS_INCLUDE) $(SOURCES_1_CC) $(SOURCES_2_CC) > depend.inc
53+
54+
clean:
55+
@rm -f *~ *.o depend.inc
56+
57+
58+
DIST_FILES= $(SOURCES_1_CC) $(SOURCES_2_CC) $(HEADERS) \
59+
Makefile Makefile.icc model.bmp model.bmp.roi \
60+
COPYING README AUTHORS
61+
62+
DIST_FN=ferns_demo-$(VER)
63+
DIST_V_FN=ferns_demo_v-$(VER)
64+
65+
dist:
66+
mkdir /tmp/$(DIST_FN)
67+
cp $(DIST_FILES) /tmp/$(DIST_FN)
68+
tar -czf $(DIST_FN).tar.gz -C /tmp $(DIST_FN)
69+
rm -fR /tmp/$(DIST_FN)
70+
71+
dist-video:
72+
mkdir /tmp/$(DIST_FN)
73+
cp $(DIST_FILES) mousepad.mp4 /tmp/$(DIST_FN)
74+
tar -czf $(DIST_V_FN).tar.gz -C /tmp $(DIST_FN)
75+
rm -fR /tmp/$(DIST_FN)
76+
77+
78+
79+
include depend.inc

Makefile.icc

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
EXECUTABLE_1_NAME = ferns_demo
2+
SOURCES_1 = main mcv planar_pattern_detector planar_pattern_detector_builder \
3+
affine_transformation_range buffer_management pyr_yape06 homography06 homography_estimator \
4+
fine_gaussian_pyramid mcvGaussianSmoothing affine_image_generator06 fern_based_point_classifier \
5+
ferns template_matching_based_tracker cmphomo
6+
7+
CC = icpc
8+
LINK = icpc
9+
10+
DEBUG_OPTIM = -g -O3 -ipo -xT -openmp -DNDEBUG
11+
#WARNINGS = -Wall -Wextra
12+
13+
OPENCV_INC = `pkg-config opencv --cflags`
14+
ALL_LIBS_INCLUDE = $(OPENCV_INC)
15+
16+
OPENCV_LIB = `pkg-config opencv --libs`
17+
18+
ALL_LIBS_LIB = $(OPENCV_LIB) -lz
19+
20+
CC_OPTIONS = $(WARNINGS) $(DEBUG_OPTIM) $(ALL_LIBS_INCLUDE)
21+
LINK_OPTIONS = $(ALL_LIBS_LIB) $(DEBUG_OPTIM)
22+
23+
24+
all: $(EXECUTABLE_1_NAME) $(EXECUTABLE_2_NAME)
25+
26+
SOURCES_1_CC = $(SOURCES_1:=.cc)
27+
SOURCES_1_OBJ = $(SOURCES_1:=.o)
28+
29+
SOURCES_2_CC = $(SOURCES_2:=.cc)
30+
SOURCES_2_OBJ = $(SOURCES_2:=.o)
31+
32+
$(EXECUTABLE_1_NAME): $(SOURCES_1_OBJ)
33+
$(LINK) $(SOURCES_1_OBJ) $(LINK_OPTIONS) -o $(EXECUTABLE_1_NAME)
34+
35+
$(EXECUTABLE_2_NAME): $(SOURCES_2_OBJ)
36+
$(LINK) $(SOURCES_2_OBJ) $(LINK_OPTIONS) -o $(EXECUTABLE_2_NAME)
37+
38+
.cc.o:
39+
$(CC) $(CC_OPTIONS) -c $*.cc
40+
41+
dep: depend.inc
42+
depend.inc:
43+
g++ -MM $(ALL_LIBS_INCLUDE) $(SOURCES_1_CC) $(SOURCES_2_CC) > depend.inc
44+
45+
clean:
46+
@rm -f *~ *.o depend.inc
47+
48+
include depend.inc

README

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
ferns-demo
2+
----------
3+
4+
This software demonstrates Fern based keypoint matching for planar
5+
object detection. It also includes template based tracking code for
6+
applications that demand even faster operation.
7+
8+
Homepage: http://cvlab.epfl.ch/software/ferns/index.php
9+
10+
Usage:
11+
------
12+
Type
13+
$ make
14+
to compile the code and generate the executable 'ferns-demo'.
15+
16+
The code depends on the OpenCV library, so you should first install
17+
and make sure that pkg-config can locate it. To test just type
18+
$ pkg-config opencv --libs --cflags
19+
and you should get a list of compiler flags.
20+
21+
The executable by default uses 'model.bmp' and 'model.bmp.roi' files
22+
to train a Fern based classifier and save it to
23+
'model.bmp.detector_data'. It then tries to open a webcam and start
24+
detecting the object. You can use the '-v' flag to specify a video
25+
file as image source. So to try detection on a video, type
26+
$ ./ferns-demo -v mousepad.mp4
27+
28+
You can also use a sequence of images to test detection,
29+
$ ./ferns-demo -s 'image%04.jpg'
30+
31+
To change the model object just take a photo of a planar object and
32+
save it. You can specify a region of interest by writing a roi file
33+
the same name as your model file + '.roi' extension. You can specify
34+
the name of the image using the '-m' option,
35+
$ ./ferns-demo -m book.jpg
36+
which will use 'book.jpg' and 'book.roi' files to generate
37+
'book.jpg.detector_data'
38+
39+
Type
40+
$ ./ferns_demo -h
41+
to see a list of command line options.
42+
43+
To change parameters for training just edit 'main.cc' and see the
44+
header file for 'planar_pattern_detector_builder.h'.
45+
46+
Template Based Tracking:
47+
------------------------
48+
Tracking can be done much faster than detection but is less reliable
49+
and needs initialization and reinitialization in case of failure. So
50+
the executable has different modes of operation that can be switched
51+
by pressing the number keys (0-3).
52+
53+
0: Detect when tracking fails or for initialization then track.
54+
1: Track only
55+
2: Detect only (DEFAULT)
56+
3: Detect + track in every frame
57+
58+
The number keys 4&5 can be used to turn on/off the recognized and
59+
detected keypoints, respectively.
60+
61+
By default the tracker is trained using the same model file as the
62+
detector and the tracker data is saved in a file having the same name
63+
as the model file + '.tracker_data' extension.
64+
65+
Windows:
66+
--------
67+
There is no automated way to compile the code under Windows. It should
68+
be relatively easy to write one, since the source code depends only on
69+
OpenCV (which has a Windows version) and a decent C++ implementation.

0 commit comments

Comments
 (0)