OpenCV

トップ > チップス > OpenCV
2014-04-03, opencv

HaarCascade用のポジティブ画像セットの作り方

一枚の画像があれば、createsamplesコマンドを使って学習用のセットを手軽に作ることができますが、それをマニュアル(手作業)でやるにはどうすれば良いのかという端的な説明を見つけました。

1. Create a set of png images from the initial dataset you have. Filter out the background, leaving only the object. You need PNG format to have transparency.
2. A set of negative background images.
3. For each positive sample, apply some distortion and/or rotation. Don't distort or rotate more than 10%.
4. Get an area of the same size to the distorted/rotated image from a random chosen negative background image.
5. Put the object on top of the background area.
6. Apply some illumination / blurring if you like.
7. Optionally you can apply some occlusion/decolourisation before step 3.
8. Save the generated sample.
9. Write the file index to a vector of string.
10. In the end, randomly shuffle the vector of string. (Important)
11. Write the content of the vector to a text file.

参考URL

この記事は役に立ちましたか?