Commit 0a40bbd0 authored by marina.kolpakova's avatar marina.kolpakova

add two types of feature boxes support:

 - (left, top, width, height)
 - (left, top, right, bottom)
parent f7921b5a
......@@ -88,7 +88,7 @@ struct Node
struct Feature
{
Feature() {}
Feature(const cv::FileNode& fn) : channel((int)fn[SC_F_CHANNEL])
Feature(const cv::FileNode& fn, bool useBoxes = false) : channel((int)fn[SC_F_CHANNEL])
{
cv::FileNode rn = fn[SC_F_RECT];
cv::FileNodeIterator r_it = rn.begin();
......@@ -99,7 +99,10 @@ struct Feature
int h = *r_it++;
// ToDo: fix me
rect = cv::Rect(x, y, w + x, h + y);
if (useBoxes)
rect = cv::Rect(x, y, w, h);
else
rect = cv::Rect(x, y, w + x, h + x);
// 1 / area
rarea = 1.f / ((rect.width - rect.x) * (rect.height - rect.y));
......@@ -353,10 +356,15 @@ struct cv::SCascade::Fields
static const char *const SC_SHRINKAGE = "shrinkage";
static const char *const FEATURE_FORMAT = "featureFormat";
// only Ada Boost supported
std::string stageTypeStr = (string)root[SC_STAGE_TYPE];
CV_Assert(stageTypeStr == SC_BOOST);
std::string fformat = (string)root[FEATURE_FORMAT];
bool useBoxes = (fformat == "BOX");
// only HOG-like integral channel features cupported
string featureTypeStr = (string)root[SC_FEATURE_TYPE];
CV_Assert(featureTypeStr == SC_ICF);
......@@ -403,7 +411,7 @@ struct cv::SCascade::Fields
st = ffs.begin(), st_end = ffs.end();
for (; st != st_end; ++st )
features.push_back(Feature(*st));
features.push_back(Feature(*st, useBoxes));
}
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment