soft cascade become Algorithm
This commit is contained in:
@@ -7,11 +7,11 @@
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
// Copyright (C) 2008-2012, Willow Garage Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -40,4 +40,21 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include <precomp.hpp>
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
||||
CV_INIT_ALGORITHM(SCascade, "CascadeDetector.SCascade",
|
||||
obj.info()->addParam(obj, "minScale", obj.minScale));
|
||||
// obj.info()->addParam(obj, "maxScale", obj.maxScale);
|
||||
// obj.info()->addParam(obj, "scales", obj.scales);
|
||||
// obj.info()->addParam(obj, "rejfactor", obj.rejfactor));
|
||||
|
||||
bool initModule_objdetect(void)
|
||||
{
|
||||
Ptr<Algorithm> sc = createSCascade();
|
||||
return sc->info() != 0;
|
||||
}
|
||||
|
||||
}
|
@@ -175,7 +175,7 @@ struct Level
|
||||
enum { R_SHIFT = 1 << 15 };
|
||||
|
||||
float scaling[2];
|
||||
typedef cv::SoftCascade::Detection detection_t;
|
||||
typedef cv::SCascade::Detection detection_t;
|
||||
|
||||
Level(const Octave& oct, const float scale, const int shrinkage, const int w, const int h)
|
||||
: octave(&oct), origScale(scale), relScale(scale / oct.scale),
|
||||
@@ -252,7 +252,7 @@ struct ChannelStorage
|
||||
|
||||
}
|
||||
|
||||
struct cv::SoftCascade::Filds
|
||||
struct cv::SCascade::Filds
|
||||
{
|
||||
float minScale;
|
||||
float maxScale;
|
||||
@@ -491,33 +491,25 @@ struct cv::SoftCascade::Filds
|
||||
}
|
||||
};
|
||||
|
||||
cv::SoftCascade::SoftCascade(const float mins, const float maxs, const int nsc)
|
||||
: filds(0), minScale(mins), maxScale(maxs), scales(nsc) {}
|
||||
cv::SCascade::SCascade(const float mins, const float maxs, const int nsc, const int rej)
|
||||
: filds(0), minScale(mins), maxScale(maxs), scales(nsc), rejfactor(rej) {}
|
||||
|
||||
cv::SoftCascade::SoftCascade(const cv::FileStorage& fs) : filds(0)
|
||||
cv::SCascade::~SCascade() { delete filds;}
|
||||
|
||||
void cv::SCascade::read(const FileNode& fn)
|
||||
{
|
||||
read(fs);
|
||||
}
|
||||
cv::SoftCascade::~SoftCascade()
|
||||
{
|
||||
delete filds;
|
||||
Algorithm::read(fn);
|
||||
}
|
||||
|
||||
bool cv::SoftCascade::read( const cv::FileStorage& fs)
|
||||
bool cv::SCascade::load(const FileNode& fn)
|
||||
{
|
||||
if (!fs.isOpened()) return false;
|
||||
|
||||
if (filds)
|
||||
delete filds;
|
||||
filds = 0;
|
||||
if (filds) delete filds;
|
||||
|
||||
filds = new Filds;
|
||||
Filds& flds = *filds;
|
||||
return flds.fill(fs.getFirstTopLevelNode(), minScale, maxScale);
|
||||
return filds->fill(fn, minScale, maxScale);
|
||||
}
|
||||
|
||||
void cv::SoftCascade::detectMultiScale(const Mat& image, const std::vector<cv::Rect>& /*rois*/,
|
||||
std::vector<Detection>& objects, const int /*rejectfactor*/) const
|
||||
void cv::SCascade::detect(const Mat& image, const std::vector<cv::Rect>& /*rois*/, std::vector<Detection>& objects) const
|
||||
{
|
||||
// only color images are supperted
|
||||
CV_Assert(image.type() == CV_8UC3);
|
||||
|
Reference in New Issue
Block a user