Take advantage of "opencv training classifier preparation XML document"
Understand the command line parameters for creating Functions
Let's take a positive sample as an example:
Suppose there are 5 positive sample image files img1.bmp ,... Img5.bmp; create a TXT text document with a positive sample named info.txt
The content of info.txt is as follows:
Positive/image1.bmp 1 0 0 24 28
Positive/image2.bmp 1 0 0 24 28
Positive/image3.bmp 1 0 0 24 28
Positive/image4.bmp 1 0 0 24 28
Positive/image5.bmp 1 0 0 24 28
Positive/image6.bmp 1 0 0 24 28
The image img1.bmp contains a single object, and the rectangle is (, 24, 28 ).
Note: to create a positive sample from an image set, use the-Info parameter instead of the-IMG parameter.
-Info <collect_file_name>
Description file of the image set marked with features.
The content of the background (negative sample) description file is as follows:
_ Img/bg1.bmp 1 0 0 24 28
_ Ing/bg2.bmp 1 0 0 24 28
_ Img/bg3.bmp 1 0 0 24 28
_ Ing/bg4.bmp 1 0 0 24 28
_ Img/bg5.bmp 1 0 0 24 28
_ Ing/bg6.bmp 1 0 0 24 28
_ Img/bg7.bmp 1 0 0 24 28
_ Ing/bg8.bmp 1 0 0 24 28
_ Img/bg9.bmp 1 0 0 24 28
_ Ing/bg10.bmp 1 0 0 24 28
These files are located in the same folder:
Now that I have talked so much nonsense, I have started to do the following:
First, open dos, (START-run-input cmd)
Switch to the folder where the file was just put, and use CD for the DOS command.
Input command
Press the Enter key to generate the positive sample file:
Okay. Next we will train the classifier. Please refer to the next article "Section 3 of the XML document for preparing opencv training classifier"