LTI-Lib latest version v1.9 - last update 10 Apr 2010

ltiBhattacharyyaDistance.h

00001 /*
00002  * Copyright (C) 2002, 2003, 2004, 2005, 2006
00003  * Lehrstuhl fuer Technische Informatik, RWTH-Aachen, Germany
00004  * 
00005  * This file is part of the LTI-Computer Vision Library (LTI-Lib)
00006  *
00007  * The LTI-Lib is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License (LGPL)
00009  * as published by the Free Software Foundation; either version 2.1 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * The LTI-Lib is distributed in the hope that it will be
00013  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
00014  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public 
00018  * License along with the LTI-Lib; see the file LICENSE.  If
00019  * not, write to the Free Software Foundation, Inc., 59 Temple Place -
00020  * Suite 330, Boston, MA 02111-1307, USA.  
00021  */ 
00022 
00023  
00024 /*--------------------------------------------------------------------
00025  * project ....: LTI-Lib: Image Processing and Computer Vision Library
00026  * file .......: ltiBhattacharyyaDistance.h
00027  * authors ....: Jens Paustenbach
00028  * organization: LTI, RWTH Aachen
00029  * creation ...: 23.8.2002
00030  * revisions ..: $Id: ltiBhattacharyyaDistance.h,v 1.5 2006/02/08 12:12:42 ltilib Exp $
00031  */
00032 
00033 #ifndef _LTI_BHATTACHARYYA_DISTANCE_H_
00034 #define _LTI_BHATTACHARYYA_DISTANCE_H_
00035 
00036 #include "ltiVector.h"
00037 #include "ltiMatrix.h"
00038 #include "ltiVarianceFunctor.h"
00039 #include "ltiLinearAlgebraFunctor.h"
00040 
00041 namespace lti {
00042   /**
00043    *  Computes the bhattacharyya distance of two distributions.
00044    *  Either two matrices with the distributions, with each row representing a
00045    *  data point, or the means and the covarianz matrices of both distributions
00046    *  are given the the functor.
00047    */
00048   class bhattacharyyaDistance : public linearAlgebraFunctor {
00049   public:
00050     /**
00051      * default constructor
00052      */
00053     bhattacharyyaDistance();
00054 
00055     /**
00056      * copy constructor
00057      * @param other the object to be copied
00058      */
00059     bhattacharyyaDistance(const bhattacharyyaDistance& other);
00060 
00061     /**
00062      * destructor
00063      */
00064     virtual ~bhattacharyyaDistance();
00065 
00066     /**
00067      * returns the name of this type ("bhattacharyyaDistance")
00068      */
00069     virtual const char* getTypeName() const;
00070   
00071     /**
00072      * compute the distance between the two distributions 
00073      * @param cluster1 dmatrix with the first distribution
00074      * @param cluster2 dmatrix with the second one
00075      * @return the distance
00076      */
00077     double apply(const dmatrix& cluster1,const dmatrix& cluster2) const;
00078 
00079     /**
00080      * compute the distance between the two distributions 
00081      * @param cluster1 dmatrix with the first distribution
00082      * @param cluster2 dmatrix with the second one
00083      * @param distance the result will be left here
00084      * @return true if apply successful or false otherwise.
00085      */
00086     bool apply(const dmatrix& cluster1,const dmatrix& cluster2,
00087                double& distance) const;
00088 
00089     /**
00090      * compute the distance between the two distributions 
00091      * @param centroid1 dvector with the first centroid
00092      * @param cov1 dmatrix with the covariance matrix of distribution 1
00093      * @param centroid2 dvector with the second centroid
00094      * @param cov2 dmatrix with the covariance matrix of distribution 2
00095      * @return the distance
00096      */
00097     double apply(const dvector& centroid1,const dmatrix& cov1,
00098                  const dvector& centroid2,const dmatrix& cov2) const;
00099 
00100     /**
00101      * compute the distance between the two distributions 
00102      * @param centroid1 dvector with the first centroid
00103      * @param cov1 dmatrix with the covariance matrix of distribution 1
00104      * @param centroid2 dvector with the second centroid
00105      * @param cov2 dmatrix with the covariance matrix of distribution 2
00106      * @param distance the result will be left here
00107      * @return true if apply successful or false otherwise.
00108      */
00109     bool apply(const dvector& centroid1,const dmatrix& cov1,
00110                const dvector& centroid2,const dmatrix& cov2,
00111                double& distance) const;
00112       
00113     /**
00114      * copy data of "other" functor.
00115      * @param other the functor to be copied
00116      * @return a reference to this functor object
00117      */
00118     bhattacharyyaDistance& copy(const bhattacharyyaDistance& other);
00119 
00120     /**
00121      * alias for copy member
00122      * @param other the functor to be copied
00123      * @return a reference to this functor object
00124      */
00125     bhattacharyyaDistance& operator=(const bhattacharyyaDistance& other);
00126 
00127     /**
00128      * returns a pointer to a clone of this functor.
00129      */
00130     virtual functor* clone() const;
00131 
00132     /**
00133      * returns used parameters
00134      */
00135     const parameters& getParameters() const;
00136 
00137 
00138   };
00139 }
00140 
00141 #endif

Generated on Sat Apr 10 15:25:08 2010 for LTI-Lib by Doxygen 1.6.1