Skip to content
This repository was archived by the owner on Aug 22, 2024. It is now read-only.

Commit 3aed0c3

Browse files
committed
Merge pull request #13 from fabianbormann/master
add mergevec.py to simplify the workflow
2 parents 9ac3c97 + 07f8c12 commit 3aed0c3

File tree

4 files changed

+179
-216
lines changed

4 files changed

+179
-216
lines changed

LICENSE

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
`createsamples.pl` and `mergevec.cpp`: Copyright (c) 2008, Naotoshi Seo
1+
`createsamples.pl`: Copyright (c) 2008, Naotoshi Seo
22
From: https://code.google.com/p/tutorial-haartraining/
3+
`mergevec.py`: Copyright (c) 2014, Blake Wulfe
4+
From: https://github.com/wulfebw/mergevec
35

46
Copyright (c) 2013, Thorsten Ball. All rights reserved.
57

README.md

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,34 +37,22 @@ to the `./samples` folder:
3737
"opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1\
3838
-maxyangle 1.1 maxzangle 0.5 -maxidev 40 -w 80 -h 40"
3939

40-
6. Compile the `mergevec.cpp` file in the `./src` directory:
40+
6. Use `tools/mergevec.py` to merge the samples in `./samples` into one file:
4141

42-
cp src/mergevec.cpp ~/opencv-2.4.9/apps/haartraining
43-
cd ~/opencv-2.4.9/apps/haartraining
44-
g++ `pkg-config --libs --cflags opencv | sed 's/libtbb\.dylib/tbb/'`\
45-
-I. -o mergevec mergevec.cpp\
46-
cvboost.cpp cvcommon.cpp cvsamples.cpp cvhaarclassifier.cpp\
47-
cvhaartraining.cpp\
48-
-lopencv_core -lopencv_calib3d -lopencv_imgproc -lopencv_highgui -lopencv_objdetect
42+
./tools/mergevec.py -v samples/ -o samples.vec
4943

50-
7. Use the compiled executable `mergevec` to merge the samples in `./samples`
51-
into one file:
52-
53-
find ./samples -name '*.vec' > samples.txt
54-
./mergevec samples.txt samples.vec
55-
56-
8. Start training the classifier with `opencv_traincascade`, which comes with
44+
7. Start training the classifier with `opencv_traincascade`, which comes with
5745
OpenCV, and save the results to `./classifier`:
5846

5947
opencv_traincascade -data classifier -vec samples.vec -bg negatives.txt\
6048
-numStages 20 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 1000\
6149
-numNeg 600 -w 80 -h 40 -mode ALL -precalcValBufSize 1024\
6250
-precalcIdxBufSize 1024
6351

64-
9. Wait until the process is finished (which takes a long time — a couple of
52+
8. Wait until the process is finished (which takes a long time — a couple of
6553
days probably, depending on the computer you have and how big your images are).
6654

67-
10. Use your finished classifier!
55+
9. Use your finished classifier!
6856

6957
cd ~/opencv-2.4.9/samples/c
7058
chmod +x build_all.sh

src/mergevec.cpp

Lines changed: 0 additions & 198 deletions
This file was deleted.

0 commit comments

Comments
 (0)