struct Octave
{
- Octave(const int i, cv::Size origObjSize, const cv::FileNode& fn)
+ Octave(const int i, const cv::Size& origObjSize, const cv::FileNode& fn)
: index(i), scale((float)fn[SC_OCT_SCALE]), stages((int)fn[SC_OCT_STAGES]),
size(cvRound(origObjSize.width * scale), cvRound(origObjSize.height * scale)),
shrinkage((int)fn[SC_OCT_SHRINKAGE]) {}
{
float minScale;
float maxScale;
+ int scales;
int origObjWidth;
int origObjHeight;
}
// compute levels of full pyramid
- void calcLevels(const cv::Size& curr, int scales)
+ void calcLevels(const cv::Size& curr, float mins, float maxs, int total)
{
- if (frameSize == curr) return;
+ if (frameSize == curr && maxs == maxScale && mins == minScale && total == scales) return;
+ CV_Assert(scales > 1);
+
frameSize = curr;
+ maxScale = maxs; minScale = mins; scales = total;
- CV_Assert(scales > 1);
levels.clear();
float logFactor = (log(maxScale) - log(minScale)) / (scales -1);
}
}
- bool fill(const FileNode &root, const float mins, const float maxs)
+ bool fill(const FileNode &root)
{
- minScale = mins;
- maxScale = maxs;
-
// cascade properties
static const char *const SC_STAGE_TYPE = "stageType";
static const char *const SC_BOOST = "BOOST";
if (fields) delete fields;
fields = new Fields;
- return fields->fill(fn, minScale, maxScale);
+ return fields->fill(fn);
}
void cv::SCascade::detectNoRoi(const cv::Mat& image, std::vector<Detection>& objects) const
CV_Assert(image.type() == CV_8UC3);
Fields& fld = *fields;
- fld.calcLevels(image.size(), scales);
+ fld.calcLevels(image.size(),minScale, maxScale, scales);
objects.clear();