Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You have done it yourself. Because you are using the minNeighbors parameter, the cascade is doing a groupRectangles, so the size of the rectangles vector is the number of detections. All you need to do is to print it somewhere:

std::cout << "Found " << cars.size() << " cars" << std::endl;

or display it in the frame using cv::putText:

std::ostringstream str;
str << "Found cars: " << cars.size();
cv::putText(image, cv::Point(10,30), str.str(), CV_FONT_HERSHEY_PLAIN, CV_RGB(0,0,250));