From: marina.kolpakova Date: Tue, 29 Jan 2013 10:27:53 +0000 (+0400) Subject: add IntegralChannelComputer X-Git-Tag: submit/tizen_ivi/20141117.190038~2^2~1187^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=49ec664238d10cb9b844f3ca3ec8096beb6b8758;p=profile%2Fivi%2Fopencv.git add IntegralChannelComputer --- diff --git a/modules/softcascade/include/opencv2/softcascade/softcascade.hpp b/modules/softcascade/include/opencv2/softcascade/softcascade.hpp index 2f5c69b..9015770 100644 --- a/modules/softcascade/include/opencv2/softcascade/softcascade.hpp +++ b/modules/softcascade/include/opencv2/softcascade/softcascade.hpp @@ -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; + +}; + // 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}; }; // ========================================================================== // diff --git a/modules/softcascade/src/integral_channel_builder.cpp b/modules/softcascade/src/integral_channel_builder.cpp new file mode 100644 index 0000000..f7eb621 --- /dev/null +++ b/modules/softcascade/src/integral_channel_builder.cpp @@ -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); +} \ No newline at end of file diff --git a/modules/softcascade/src/softcascade_init.cpp b/modules/softcascade/src/softcascade_init.cpp index eb2eae1..e31abbc 100644 --- a/modules/softcascade/src/softcascade_init.cpp +++ b/modules/softcascade/src/softcascade_init.cpp @@ -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 sc = createSoftCascadeDetector(); - return sc->info() != 0; + Ptr sc1 = createSoftCascadeDetector(); + Ptr sc2 = createIntegralChannelBuilder(); + return (sc1->info() != 0) && (sc2->info() != 0); } } \ No newline at end of file