10.28.2010

OpenCV - how to create xml file for adaboost

Preparation

1. Install Open CV 2.1.0.0

2. Positive images
3. Negative images
4. ImageClipper (FreeSoftware)
5. KRename (file name)(FreeSoftware)

Steps


1. Create 3 folders
  • Negatives
  • Output
  • Positives
2. Copy two ".exe" files and some ".dll" files to "test folder" from OpenCV bin folder.

opencv_createsamples.exe

opencv_haartraining.exe

3. Use Image Clipper to label your feature on positive picture


4. ImageClipper


Label your feature


5. Use command under the folder for positives/imageclipper


dir /b /s > positives.txt

/b Uses bare format (no heading information or summary).
/s Displays files in specified directory and all subdirectories.
> Takes the output of dir and re-routes it to the file “xxx.txt” instead of outputting it to the screen

6. Use UltraEdit to modify input format

Filename [feature number] [x][y][w][h]


7. Create samples

opencv_createsamples.exe -info positives/positives.txt -vec output/positives.vec -num 515 -w 20 -h 20
[-info ]
[-vec ]
[-num ]
[-w ]
[-h ]

8. Haartraining

opencv_haartraining.exe -data output/dataALL -vec output/positives.vec -bg negatives/negatives.txt -mem 2048 -mode ALL -w 20 -h 20
[-data]
[-vec ]
[-bg ]
[-mem ]
[-mode ]
[-w ]
[-h ]

Reference