OPENCV_CREATESAMPLES(1)

πŸ“¦ version 4.5.4, in ubuntu jammy

πŸ’– 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. πŸ’œ

  • -info collection_file_name β€” a database of positive source images. use it together with -img to create test samples instead. πŸ‘―
  • -img image_file_name β€” a positive source image. use it together with -info to create test samples instead. it's giving duo energy fr fr. 🫢
  • -vec vec_file_name β€” the output file name that's gonna hold all your generated positive samples for training. your lil bundle of joy. πŸŽ€
  • -bg background_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. πŸ–ΌοΈ
  • -num number_of_samples β€” how many positive samples you wanna generate/train. default is 1000. go off. ✨
  • -bgcolor background_color β€” the background color (currently grayscale images are assumed, she's lowkey old school). the background color is the transparent color. default is 0. πŸ’€
  • -inv β€” invert the colors. 🌈
  • -maxidev max_intensity_deviation β€” the desired maximum intensity deviation of the foreground samples pixels. default is 40. πŸ”₯
  • -maxxangle max_x_rotation_angle β€” the maximum rotation angle in the x-direction, in radians. default is 1.1. πŸ“
  • -maxyangle max_y_rotation_angle β€” the maximum rotation angle in the y-direction, in radians. default is 1.1. πŸ“
  • -maxzangle max_z_rotation_angle β€” the maximum rotation angle in the z-direction, in radians. default is 0.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 is 4.0. 🎬
if <ESC> is pressed, the creation process keeps going, it just stops showing you the samples. super useful for debugging purposes, bestie. 😭
  • -h sample_height β€” when you're creating training samples, this is the resulting sample height. the default is 24. πŸ“

when you're creating test samples instead, it's the minimal height of the placed object picture.

  • -w sample_width β€” when you're creating training samples, this is the resulting sample width. the default is 24. πŸ“

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 πŸ‘€

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