JS技术

正式使用opencv里的训练和检测 - opencv_createsamples、opencv_traincascade(3)

字号+ 作者:H5之家 来源:H5之家 2015-12-15 08:44 我要评论( )

(createsamples.cpp) [-info collection_file_name]\n [-img image_file_name]\n [-vec vec_file_name]\n [-bg background_file_name]\n [-num number_of_samples = %d]\n [-bgcolor background_color = %d]\n [-

(createsamples.cpp)

" [-info <collection_file_name>]\n" " [-img <image_file_name>]\n" " [-vec <vec_file_name>]\n" " [-bg <background_file_name>]\n [-num <number_of_samples = %d>]\n" " [-bgcolor <background_color = %d>]\n" " [-inv] [-randinv] [-bgthresh <background_color_threshold = %d>]\n" " [-maxidev <max_intensity_deviation = %d>]\n" " [-maxxangle <max_x_rotation_angle = %f>]\n" " [-maxyangle <max_y_rotation_angle = %f>]\n" " [-maxzangle <max_z_rotation_angle = %f>]\n" " [-show [<scale = %f>]]\n" " [-w <sample_width = %d>]\n [-h <sample_height = %d>]\n"//默认24*24

以下1)~4)是按顺序判断,且有且仅有一个

1)提供imagename 和vecname时,调用以下操作
/* * cvCreateTrainingSamples * * Create training samples applying random distortions to sample image and * store them in .vec file * * filename - .vec file name * imgfilename - sample image file name * bgcolor - background color for sample image * bgthreshold - background color threshold. Pixels those colors are in range * [bgcolor-bgthreshold, bgcolor+bgthreshold] are considered as transparent * bgfilename - background description file name. If not NULL samples * will be put on arbitrary background * count - desired number of samples * invert - if not 0 sample foreground pixels will be inverted * if invert == CV_RANDOM_INVERT then samples will be inverted randomly * maxintensitydev - desired max intensity deviation of foreground samples pixels * maxxangle - max rotation angles * maxyangle * maxzangle * showsamples - if not 0 samples will be shown * winwidth - desired samples width * winheight - desired samples height */2)提供imagename、bgfilename和infoname时
与1)类似
3)提供 infoname和 vecname时,调用以下操作(这里是我们训练需要的)
/* * cvCreateTrainingSamplesFromInfo * * Create training samples from a set of marked up images and store them into .vec file * infoname - file in which marked up image descriptions are stored * num - desired number of samples * showsamples - if not 0 samples will be shown * winwidth - sample width * winheight - sample height * * Return number of successfully created samples */ int cvCreateTrainingSamplesFromInfo( const char* infoname, const char* vecfilename, int num, int showsamples, int winwidth, int winheight )

函数内容:读取当前图中所有标记的sample(x,y,w,h),并将其缩放到winwidth、winheight大小,故在这之前的人为缩放操作不需要

(可以看到,仅需要num、w、h参数)
4)仅vecname时,可以将vec里面的所有缩放后的samples都显示出来
/* * cvShowVecSamples * * Shows samples stored in .vec file * * filename * .vec file name * winwidth * sample width * winheight * sample height * scale * the scale each sample is adjusted to(这个scale与3中的缩放不是一回事,这里仅为了显示而再次缩放) */ void cvShowVecSamples( const char* filename, int winwidth, int winheight, double scale );

2、opencv_haartraining.exe的参数

(haartraining.cpp )

" -data <dir_name>\n" " -vec <vec_file_name>\n" " -bg <background_file_name>\n" " [-bg-vecfile]\n" " [-npos <number_of_positive_samples = %d>]\n" " [-nneg <number_of_negative_samples = %d>]\n" " [-nstages <number_of_stages = %d>]\n" " [-nsplits <number_of_splits = %d>]\n" " [-mem <memory_in_MB = %d>]\n" " [-sym (default)] [-nonsym]\n" " [-minhitrate <min_hit_rate = %f>]\n" " [-maxfalsealarm <max_false_alarm_rate = %f>]\n" " [-weighttrimming <weight_trimming = %f>]\n" " [-eqw]\n" " [-mode <BASIC (default) | CORE | ALL>]\n" " [-w <sample_width = %d>]\n" " [-h <sample_height = %d>]\n" " [-bt <DAB | RAB | LB | GAB (default)>]\n" " [-err <misclass (default) | gini | entropy>]\n" " [-maxtreesplits <max_number_of_splits_in_tree_cascade = %d>]\n" " [-minpos <min_number_of_positive_samples_per_cluster = %d>]\n"

3、opencv_performance.exe参数

 

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

相关文章
  • AngularJS使用HTML5摄像头拍照

    AngularJS使用HTML5摄像头拍照

    2016-02-23 09:42

  • 从Container内存监控限制到CPU使用率限制方案 - 走在前往架构师的路上 - 博客频道 - CSDN.NET 走

    从Container内存监控限制到CPU使用率限制方案 - 走在前往架构师的路

    2015-12-15 09:09

  • 数据抽取工具Kettle使用 - 唐僧打怪兽 - 博客频道 - CSDN.NET 唐僧打怪兽 热爱互联网,编程,比如:J

    数据抽取工具Kettle使用 - 唐僧打怪兽 - 博客频道 - CSDN.NET 唐僧打

    2015-12-14 15:37

  • Oracle数据库Decode()函数的使用方法 - 周泽辉的CSDN博客... - 博客频道 - CSDN.NET 周

    Oracle数据库Decode()函数的使用方法 - 周泽辉的CSDN博客... - 博客

    2015-12-14 15:05

网友点评
/