add IntegralChannelComputer

pull/322/head
marina.kolpakova 12 years ago
parent 716a9ccb71
commit 49ec664238
  1. 78
      modules/softcascade/include/opencv2/softcascade/softcascade.hpp
  2. 55
      modules/softcascade/src/integral_channel_builder.cpp
  3. 9
      modules/softcascade/src/softcascade_init.cpp

@ -48,15 +48,6 @@
namespace cv {
class CV_EXPORTS_W ICFPreprocessor
{
public:
CV_WRAP ICFPreprocessor();
CV_WRAP void apply(cv::InputArray _frame, cv::OutputArray _integrals) const;
protected:
enum {BINS = 10};
};
// Representation of detectors result.
struct CV_EXPORTS Detection
{
@ -74,6 +65,51 @@ struct CV_EXPORTS Detection
int kind;
};
class CV_EXPORTS FeaturePool
{
public:
virtual int size() const = 0;
virtual float apply(int fi, int si, const Mat& integrals) const = 0;
virtual void write( cv::FileStorage& fs, int index) const = 0;
virtual void preprocess(InputArray frame, OutputArray integrals) const = 0;
virtual ~FeaturePool();
};
class CV_EXPORTS Dataset
{
public:
typedef enum {POSITIVE = 1, NEGATIVE = 2} SampleType;
virtual cv::Mat get(SampleType type, int idx) const = 0;
virtual int available(SampleType type) const = 0;
virtual ~Dataset();
};
// ========================================================================== //
// Implementation of Integral Channel Feature.
// ========================================================================== //
class CV_EXPORTS_W IntegralChannelBuilder : public Algorithm
{
public:
CV_WRAP IntegralChannelBuilder();
CV_WRAP virtual ~IntegralChannelBuilder();
cv::AlgorithmInfo* info() const;
// Load channel builder config.
CV_WRAP virtual void read(const FileNode& fileNode);
private:
struct Fields;
cv::Ptr<Fields> fields;
};
// Create channel integrals for Soft Cascade detector.
class CV_EXPORTS Channels
{
@ -97,27 +133,13 @@ private:
int shrinkage;
};
class CV_EXPORTS FeaturePool
{
public:
virtual int size() const = 0;
virtual float apply(int fi, int si, const Mat& integrals) const = 0;
virtual void write( cv::FileStorage& fs, int index) const = 0;
virtual void preprocess(InputArray frame, OutputArray integrals) const = 0;
virtual ~FeaturePool();
};
class CV_EXPORTS Dataset
class CV_EXPORTS_W ICFPreprocessor
{
public:
typedef enum {POSITIVE = 1, NEGATIVE = 2} SampleType;
virtual cv::Mat get(SampleType type, int idx) const = 0;
virtual int available(SampleType type) const = 0;
virtual ~Dataset();
CV_WRAP ICFPreprocessor();
CV_WRAP void apply(cv::InputArray _frame, cv::OutputArray _integrals) const;
protected:
enum {BINS = 10};
};
// ========================================================================== //

@ -0,0 +1,55 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2008-2013, 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,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and / or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "precomp.hpp"
struct cv::IntegralChannelBuilder::Fields
{
};
cv::IntegralChannelBuilder::IntegralChannelBuilder() : fields(new Fields()) {}
cv::IntegralChannelBuilder::~IntegralChannelBuilder() {}
void cv::IntegralChannelBuilder::read(const FileNode& fn)
{
Algorithm::read(fn);
}

@ -45,16 +45,19 @@
namespace cv
{
CV_INIT_ALGORITHM(SoftCascadeDetector, "CascadeDetector.SoftCascadeDetector",
CV_INIT_ALGORITHM(SoftCascadeDetector, "SoftCascade.SoftCascadeDetector",
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, "rejCriteria", obj.rejCriteria));
CV_INIT_ALGORITHM(IntegralChannelBuilder, "SoftCascade.IntegralChannelBuilder", );
bool initModule_softcascade(void)
{
Ptr<Algorithm> sc = createSoftCascadeDetector();
return sc->info() != 0;
Ptr<Algorithm> sc1 = createSoftCascadeDetector();
Ptr<Algorithm> sc2 = createIntegralChannelBuilder();
return (sc1->info() != 0) && (sc2->info() != 0);
}
}
Loading…
Cancel
Save