문제

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!

도움이 되었습니까?

해결책

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
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top