Commit 51c68423 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

alter the read stage.threshold to match traincascade behavior (ticket #1071)

parent d4032009
...@@ -1236,6 +1236,8 @@ void CascadeClassifier::detectMultiScale( const Mat& image, vector<Rect>& object ...@@ -1236,6 +1236,8 @@ void CascadeClassifier::detectMultiScale( const Mat& image, vector<Rect>& object
bool CascadeClassifier::Data::read(const FileNode &root) bool CascadeClassifier::Data::read(const FileNode &root)
{ {
static const float THRESHOLD_EPS = 1e-5f;
// load stage params // load stage params
string stageTypeStr = (string)root[CC_STAGE_TYPE]; string stageTypeStr = (string)root[CC_STAGE_TYPE];
if( stageTypeStr == CC_BOOST ) if( stageTypeStr == CC_BOOST )
...@@ -1281,7 +1283,7 @@ bool CascadeClassifier::Data::read(const FileNode &root) ...@@ -1281,7 +1283,7 @@ bool CascadeClassifier::Data::read(const FileNode &root)
{ {
FileNode fns = *it; FileNode fns = *it;
Stage stage; Stage stage;
stage.threshold = fns[CC_STAGE_THRESHOLD]; stage.threshold = (float)fns[CC_STAGE_THRESHOLD] - THRESHOLD_EPS;
fns = fns[CC_WEAK_CLASSIFIERS]; fns = fns[CC_WEAK_CLASSIFIERS];
if(fns.empty()) if(fns.empty())
return false; return false;
......
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