detect (cv.CascadeClassifier) - MATLAB File Help
cv.CascadeClassifier/detect

Detects objects of different sizes in the input image

boxes = classifier.detect(im)
[boxes, numDetections] = classifier.detect(im)
[boxes, rejectLevels, levelWeights] = classifier.detect(im)
[...] = classifier.detect(im, 'OptionName', optionValue, ...)

Input

Output

Options

The detected objects are returned as a cell array of rectangles. Note that the function has three variants based on the number of output arguments.

The function is parallelized with the TBB library.

The third variant allows you to retrieve the final stage decision certainty of classification. For this, one needs to set OutputRejectLevels to true and request the rejectLevels and levelWeights output arguments. For each resulting detection, levelWeights will then contain the certainty of classification at the final stage. This value can then be used to separate strong from weaker classifications. A code sample on how to use it efficiently can be found below:

model = cv.CascadeClassifier('/path/to/your/model.xml');
[boxes, levels, weights] = model.detect(img, 'OutputRejectLevels',true);
fprintf('Detection [%d,%d,%d,%d] with weight %f\n', boxes{1}, weights(1));
See also
Method Details
Access public
Sealed false
Static false