ImageEn, unit ievision

TIEVisionCascadeClassifierTrainer.createSamplesFromImageSet

TIEVisionCascadeClassifierTrainer.createSamplesFromImageSet


Declaration

function createSamplesFromImageSet(positiveSamplesDir: PAnsiChar; vecname: PAnsiChar; width: int32_t; height: int32_t): int32_t; safecall;


Description

Create a file containing a set of positive samples, generated from a set of positive samples. The samples are converted to gray scale and resampled to the specified width and height sizes.
This function returns number of samples embedded in the output file.
The result of this function (named "vec" file) is then passed to trainCascade for the actual training.



Parameter Description
positiveSamplesDir A directory containing the positive samples. Each sample should contain a random background
vecname The output sample file. For example "sample.vec"
width Width (in pixels) of the output samples
height Height (in pixels) of the output samples


Demo

Demo  Demos\IEVision\TrainCascadeClassifier\TrainCascadeClassifier.dpr


Example

// create training samples file "samples.vec" from real positive samples stored in 'positive_images"
imagesCount = cascadeTrainer.createSamplesFromImageSet('positive_images', 'samples.vec', 40, 40);
// trainCascade images count must be less than 85% of the images in "vec" file
imagesCount := trunc(imagesCount * 0.85);
// train the cascade classifier with 10 stages using LBP. The output will be "trainingresult\cascade.xml", the you should use in TIEVisionObjectsFinder to find objects.
cascadeTrainer.trainCascade('trainingresult', 'samples.vec', 'negative_images', imagesCount, 40, 40, 10, ievLBP);


See Also

 trainCascade