@@ -37,34 +37,22 @@ to the `./samples` folder:
37
37
"opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1\
38
38
-maxyangle 1.1 maxzangle 0.5 -maxidev 40 -w 80 -h 40"
39
39
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 :
41
41
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
49
43
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
57
45
OpenCV, and save the results to ` ./classifier ` :
58
46
59
47
opencv_traincascade -data classifier -vec samples.vec -bg negatives.txt\
60
48
-numStages 20 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 1000\
61
49
-numNeg 600 -w 80 -h 40 -mode ALL -precalcValBufSize 1024\
62
50
-precalcIdxBufSize 1024
63
51
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
65
53
days probably, depending on the computer you have and how big your images are).
66
54
67
- 10 . Use your finished classifier!
55
+ 9 . Use your finished classifier!
68
56
69
57
cd ~/opencv-2.4.9/samples/c
70
58
chmod +x build_all.sh
0 commit comments