OPENCV_CREATESAMPLES(1)
π OPENCV_CREATESAMPLES π
okay bestie, welcome to opencv_createsamples(1) β she's a User Command and she's here to make you some samples. let's go π«Ά
β¨ NAME β¨
opencv_createsamples β create training and testing samples. that's it. that's the girl. π
πΈ SYNOPSIS πΈ
opencv_createsamples [options]
no subcommands, no drama, just vibes and flags. π
π¦ DESCRIPTION π¦
so opencv_createsamples makes positive samples from a single object image or from a whole collection of positive images. pick your fighter. π
and the scheme for making test samples? it's basically the same as making training samples, no cap. because every single test sample is a background image, and into that background gets pasted a randomly distorted and randomly scaled instance of your object picture, at a random position. chaotic? yes. iconic? also yes. β¨
π OPTIONS π
opencv_createsamples supports the following options, and yes we're doing all of them, every single one, no skipping. periodt. π
-infocollection_file_name β a database of positive source images. use it together with-imgto create test samples instead. π―-imgimage_file_name β a positive source image. use it together with-infoto create test samples instead. it's giving duo energy fr fr. π«Ά-vecvec_file_name β the output file name that's gonna hold all your generated positive samples for training. your lil bundle of joy. π-bgbackground_file_name β the background description file, aka the negative sample set. it's a list of images, and randomly distorted versions of your object get pasted into them to generate positive samples. πΌοΈ-numnumber_of_samples β how many positive samples you wanna generate/train. default is1000. go off. β¨-bgcolorbackground_color β the background color (currently grayscale images are assumed, she's lowkey old school). the background color is the transparent color. default is0. π-invβ invert the colors. π-maxidevmax_intensity_deviation β the desired maximum intensity deviation of the foreground samples pixels. default is40. π₯-maxxanglemax_x_rotation_angle β the maximum rotation angle in the x-direction, in radians. default is1.1. π-maxyanglemax_y_rotation_angle β the maximum rotation angle in the y-direction, in radians. default is1.1. π-maxzanglemax_z_rotation_angle β the maximum rotation angle in the z-direction, in radians. default is0.5. π-show[scale_factor] β show every sample as it's being created, live, like a lil premiere. you can optionally define a scaling factor. the default is4.0. π¬
if <ESC> is pressed, the creation process keeps going, it just stops showing you the samples. super useful for debugging purposes, bestie. π
-hsample_height β when you're creating training samples, this is the resulting sample height. the default is24. π
when you're creating test samples instead, it's the minimal height of the placed object picture.
-wsample_width β when you're creating training samples, this is the resulting sample width. the default is24. π
when you're creating test samples instead, it's the minimal width of the placed object picture.
also?? the exact same info gets shown if you call opencv_createsamples with no arguments and no options at all. free help, no cap. π«Ά
π EXAMPLES π
wanna create training samples from one image, apply some distortions, and literally watch the results? say less:
opencv_createsamples -img source.png -num 10 -bg negatives.dat
-vec samples_out.vec -show
and here's how you create training samples of size 40x40 from some images without applying distortions:
opencv_creasamples -info source.dat -vec samples_out.vec -w 40 -h
40
(yes that second one says opencv_creasamples, not opencv_createsamples β she's a little typo'd, we don't fix her, we just respect her journey ππ)
π SEE ALSO π
opencv_haartraing(1)opencv_performance(1)
more information and examples can be found in the OpenCV documentation. iykyk. πβ¨
π AUTHORS π
this manual page was written by Daniel Leidert <daniel.leidert@wgdd.de> and Nobuhiro Iwamatsu <iwamatsu@debian.org> for the Debian project (but may be used by others). legends, honestly. π
and that's the whole page, bestie!! π from OpenCV, dated May 2010 β yeah she's a vintage queen and she still ate. π β¨πΈπ¦π
π¦ where this page comes from
- ubuntu jammy: libopencv-dev 4.5.4+dfsg-9ubuntu4 Β· Apache-2.0 AND BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms