0

The function detectMultiScale() returns void, so it is not possible to check whether the the object was detected or not using that function

I wish to pass the frame no., at which the object was detected, to a text file. I don't know how to do that when I can't check whether the cascade was detected or not ?

Should I use cvHaarDetectObjects() from C API ?

Kindly help!

Animesh Pandey
  • 5,900
  • 13
  • 64
  • 130

1 Answers1

1

The second parameter to CascadeClassifier::detectMultiScale() is a vector of rectangles. You can check its size:

std::vector<cv::Rect> objs;
cascade.detectMultiScale(img, objs, scalefactor, minneighbors);

if (objs.size()) {
  // success
} else {
  // failed
}
flowfree
  • 16,356
  • 12
  • 52
  • 76