Ask Your Question

opencv_createsamples don't generate enough positive samples

asked 2016-05-29 04:35:41 -0500

yb gravatar image

I'm trying to generate positive samples for haar training using opencv_createsamples with one positive image and 6 background images. When I specify number of samples to be generated using -num it's only work if number of samples is less than 6. If i specify higher number like 10 or 20 it only generate 6 samples. To make more samples do i need to use more background images?

edit retag flag offensive close merge delete


Yes, you should use more background images, you can even not specify -num if you want to get the same number of samples as background images.

danaro gravatar imagedanaro ( 2016-07-01 12:45:22 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-10-09 02:54:57 -0500

efan gravatar image

I find the same issue, that's because createsamples check the -num parameter with the number of background images, and take the smaller one. To solve this problem, you could modify apps/createsamples/utility.cpp, in about line 1362: count = MIN( count, cvbgdata->count ); Change it into: count = MAX( count, cvbgdata->count );

I don't know why it is restricted to the smaller one. I have changed it myself, it's very convenient to use this tool to create lots of samples using a few images and backgrounds.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-05-29 04:35:41 -0500

Seen: 109 times

Last updated: May 29 '16