Integral Channel Features Detector
This section describes classes for object detection using WaldBoost and Integral
Channel Features from [Šochman05] and [Dollár09].
computeChannels
Compute channels for integral channel features evaluation
-
C++: void computeChannels(InputArray image, vector<Mat>& channels)
Parameters: |
- image – image for which channels should be computed
- channels – output array for computed channels
|
FeatureEvaluator
Feature evaluation interface
-
class FeatureEvaluator : public Algorithm
FeatureEvaluator::setChannels
Set channels for feature evaluation
-
C++: void FeatureEvaluator::setChannels(InputArrayOfArrays channels)
Parameters: |
- channels – array of channels to be set
|
FeatureEvaluator::setPosition
Set window position to sample features with shift. By default position is (0, 0).
-
C++: void FeatureEvaluator::setPosition(Size position)
Parameters: |
- position – position to be set
|
FeatureEvaluator::evaluate
Evaluate feature value with given index for current channels and window position.
-
C++: int FeatureEvaluator::evaluate(size_t feature_ind) const
Parameters: |
- feature_ind – index of feature to be evaluated
|
FeatureEvaluator::evaluateAll
Evaluate all features for current channels and window position.
-
C++: void FeatureEvaluator::evaluateAll(OutputArray feature_values)
Parameters: |
- feature_values – matrix-column of evaluated feature values
|
generateFeatures
Generate integral features. Returns vector of features.
-
C++: vector<vector<int>> generateFeatures(Size window_size, const string& type, int count=INT_MAX, int channel_count=10)
Parameters: |
- window_size – size of window in which features should be evaluated
- type – feature type. Can be “icf” or “acf”
- count – number of features to generate.
- channel_count – number of feature channels
|
createFeatureEvaluator
Construct feature evaluator.
-
C++: Ptr<FeatureEvaluator> createFeatureEvaluator(const vector<vector<int>>& features, const string& type)
Parameters: |
- features – features for evaluation
- type – feature type. Can be “icf” or “acf”
|
WaldBoostParams
Parameters for WaldBoost. weak_count — number of weak learners, alpha — cascade
thresholding param.
struct CV_EXPORTS WaldBoostParams
{
int weak_count;
float alpha;
WaldBoostParams(): weak_count(100), alpha(0.02f)
{}
};
WaldBoost
-
class WaldBoost : public Algorithm
WaldBoost::train
Train WaldBoost cascade for given data. Returns feature indices chosen for
cascade. Feature enumeration starts from 0.
-
C++: vector<int> WaldBoost::train(const Mat& data, const Mat& labels)
Parameters: |
- data – matrix of feature values, size M x N, one feature per row
- labels – matrix of samples class labels, size 1 x N. Labels can be from {-1, +1}
|
WaldBoost::predict
Predict objects class given object that can compute object features. Returns
unnormed confidence value — measure of confidence that object is from class +1.
-
C++: float WaldBoost::predict(const Ptr<FeatureEvaluator>& feature_evaluator) const
Parameters: |
- feature_evaluator – object that can compute features by demand
|
WaldBoost::write
Write WaldBoost to FileStorage
-
C++: void WaldBoost::write(FileStorage& fs)
Parameters: |
- fs – FileStorage for output
|
WaldBoost::read
Write WaldBoost to FileNode
-
C++: void WaldBoost::read(const FileNode& node)
Parameters: |
- node – FileNode for reading
|
createWaldBoost
Construct WaldBoost object.
-
C++: Ptr<WaldBoost> createWaldBoost(const WaldBoostParams& params=WaldBoostParams())
ICFDetectorParams
Params for ICFDetector training.
struct CV_EXPORTS ICFDetectorParams
{
int feature_count;
int weak_count;
int model_n_rows;
int model_n_cols;
int bg_per_image;
std::string features_type;
float alpha;
bool is_grayscale;
bool use_fast_log;
ICFDetectorParams(): feature_count(UINT_MAX), weak_count(100),
model_n_rows(56), model_n_cols(56), bg_per_image(5),
alpha(0.02), is_grayscale(false), use_fast_log(false)
{}
};
ICFDetector
-
class ICFDetector
ICFDetector::train
Train detector.
-
C++: void ICFDetector::train(const std::vector<String>& pos_filenames, const std::vector<String>& bg_filenames, ICFDetectorParams params=ICFDetectorParams())
Parameters: |
- pos_path – path to folder with images of objects (wildcards like /my/path/*.png are allowed)
- bg_path – path to folder with background images
- params – parameters for detector training
|
ICFDetector::detect
Detect objects on image.
-
C++: void ICFDetector::detect(const Mat& image, vector<Rect>& objects, float scaleFactor, Size minSize, Size maxSize, float threshold, int slidingStep, std::vector<float>& values)
-
C++: detect(const Mat& img, std::vector<Rect>& objects, float minScaleFactor, float maxScaleFactor, float factorStep, float threshold, int slidingStep, std::vector<float>& values)
Parameters: |
- image – image for detection
- objects – output array of bounding boxes
- scaleFactor – scale between layers in detection pyramid
- minSize – min size of objects in pixels
- maxSize – max size of objects in pixels
- minScaleFactor – min factor by which the image will be resized
- maxScaleFactor – max factor by which the image will be resized
- factorStep – scaling factor is incremented each pyramid layer according to this parameter
- slidingStep – sliding window step
- values – output vector with values of positive samples
|
ICFDetector::write
Write detector to FileStorage.
-
C++: void ICFDetector::write(FileStorage& fs) const
Parameters: |
- fs – FileStorage for output
|
ICFDetector::read
Write ICFDetector to FileNode
-
C++: void ICFDetector::read(const FileNode& node)
Parameters: |
- node – FileNode for reading
|
[Šochman05] |
- Šochman and J. Matas. WaldBoost – Learning for Time Constrained Sequential Detection”, CVPR, 2005. The paper is available online.
|
[Dollár09] |
- Dollár, Z. Tu, P. Perona and S. Belongie. “Integral Channel Features”, BMCV 2009. The paper is available online.
|