Reverted back to the previous method where a public method groupRectangles was added to HOGDescriptor to take care of ROI and weight grouping

This commit is contained in:
Bahram Dahi
2013-05-24 18:25:23 -04:00
parent 8c25f9f28a
commit dcad6ce65a
3 changed files with 115 additions and 39 deletions

View File

@@ -114,24 +114,6 @@ struct Logger
namespace cv
{
// class for grouping object candidates, detected by Cascade Classifier, HOG etc.
// instance of the class is to be passed to cv::partition (see cxoperations.hpp)
class CV_EXPORTS SimilarRects
{
public:
SimilarRects(double _eps) : eps(_eps) {}
inline bool operator()(const Rect& r1, const Rect& r2) const
{
double delta = eps*(std::min(r1.width, r2.width) + std::min(r1.height, r2.height))*0.5;
return std::abs(r1.x - r2.x) <= delta &&
std::abs(r1.y - r2.y) <= delta &&
std::abs(r1.x + r1.width - r2.x - r2.width) <= delta &&
std::abs(r1.y + r1.height - r2.y - r2.height) <= delta;
}
double eps;
};
void groupRectangles(vector<Rect>& rectList, int groupThreshold, double eps, vector<int>* weights, vector<double>* levelWeights)
{
if( groupThreshold <= 0 || rectList.empty() )