From 1e69bd5118ef41b10ad315e9d13f8556be06eec4 Mon Sep 17 00:00:00 2001 From: Alexey Kazakov Date: Fri, 22 Apr 2011 16:11:35 +0000 Subject: [PATCH] class MeanshiftGrouping replaced from objdetect.hpp to cascadedetect.cpp --- .../include/opencv2/objdetect/objdetect.hpp | 31 --- modules/objdetect/src/cascadedetect.cpp | 148 +++++++++++++++ modules/objdetect/src/ms_grouping.cpp | 177 ------------------ 3 files changed, 148 insertions(+), 208 deletions(-) delete mode 100644 modules/objdetect/src/ms_grouping.cpp diff --git a/modules/objdetect/include/opencv2/objdetect/objdetect.hpp b/modules/objdetect/include/opencv2/objdetect/objdetect.hpp index cc0e85c61..34cc5885a 100644 --- a/modules/objdetect/include/opencv2/objdetect/objdetect.hpp +++ b/modules/objdetect/include/opencv2/objdetect/objdetect.hpp @@ -297,37 +297,6 @@ CV_EXPORTS void groupRectangles(vector& rectList, vector& rejectLevel CV_EXPORTS void groupRectangles_meanshift(vector& rectList, vector& foundWeights, vector& foundScales, double detectThreshold = 0.0, Size winDetSize = Size(64, 128)); -class MeanshiftGrouping -{ -public: - MeanshiftGrouping(const Point3d& densKer, const vector& posV, - const vector& wV, double modeEps = 1e-4, - int maxIt = 20); - - void getModes(vector& modesV, vector& resWeightsV, const double eps); - -protected: - vector positionsV; - vector weightsV; - - Point3d densityKernel; - int positionsCount; - - vector meanshiftV; - vector distanceV; - int iterMax; - double modeEps; - - Point3d getNewValue(const Point3d& inPt) const; - - double getResultWeight(const Point3d& inPt) const; - - Point3d moveToMode(Point3d aPt) const; - - double getDistance(Point3d p1, Point3d p2) const; -}; - - class CV_EXPORTS FeatureEvaluator { diff --git a/modules/objdetect/src/cascadedetect.cpp b/modules/objdetect/src/cascadedetect.cpp index e36d67040..788784f76 100644 --- a/modules/objdetect/src/cascadedetect.cpp +++ b/modules/objdetect/src/cascadedetect.cpp @@ -164,6 +164,154 @@ static void groupRectangles(vector& rectList, int groupThreshold, double e } } +class MeanshiftGrouping +{ +public: + MeanshiftGrouping(const Point3d& densKer, const vector& posV, + const vector& wV, double modeEps = 1e-4, int maxIter = 20) + { + densityKernel = densKer; + weightsV = wV; + positionsV = posV; + positionsCount = posV.size(); + meanshiftV.resize(positionsCount); + distanceV.resize(positionsCount); + modeEps = modeEps; + iterMax = maxIter; + + for (unsigned i = 0; i& modesV, vector& resWeightsV, const double eps) + { + for (size_t i=0; i positionsV; + vector weightsV; + + Point3d densityKernel; + int positionsCount; + + vector meanshiftV; + vector distanceV; + int iterMax; + double modeEps; + + Point3d getNewValue(const Point3d& inPt) const + { + Point3d resPoint(.0); + Point3d ratPoint(.0); + for (size_t i=0; i& rectList, double detectThreshold, vector* foundWeights, vector& scales, Size winDetSize) diff --git a/modules/objdetect/src/ms_grouping.cpp b/modules/objdetect/src/ms_grouping.cpp deleted file mode 100644 index 0b9a41f6a..000000000 --- a/modules/objdetect/src/ms_grouping.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/*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) 2009, 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" -using namespace cv; - -MeanshiftGrouping::MeanshiftGrouping(const Point3d& densKer, const vector& posV, - const vector& wV, double modeEps, int maxIter) -{ - densityKernel = densKer; - weightsV = wV; - positionsV = posV; - positionsCount = posV.size(); - meanshiftV.resize(positionsCount); - distanceV.resize(positionsCount); - modeEps = modeEps; - iterMax = maxIter; - - for (unsigned i=0; i& modesV, vector& resWeightsV, double eps) -{ - for (size_t i=0; i