Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CondensImg.hh
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003-2009 (see file CONTACT for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 
25 
26 #ifndef __BIAS_CONDENSATION_HH__
27 #define __BIAS_CONDENSATION_HH__
28 #include "./Condensation.hh"
29 #include "Base/Image/Image.hh"
30 #include "Base/Math/Vector2.hh"
31 
32 namespace BIAS {
33 
34 /** @class CondensImg
35  * @ingroup g_stateestimation
36  @brief example class for condensation with a 2-dim state vector.
37 
38  The observation p(Z|X) is simply an image, where the greyvalue represents
39  the probabilty.<br>
40  See condensImgExample.cpp also!
41  @author Daniel Grest, Feb. 2004
42 */
43 
44 class BIASStateEstimator_EXPORT CondensImg : public Condensation
45 {
46 public:
47  /** u have to set the stateDim in the constructor!
48  */
49  CondensImg() { stateDim_=2;}
50 
51  virtual void InitModelDefaults();
52 
53  virtual void InitPriorPositions(unsigned int nrOfInitSamples);
54 
55  virtual void EvaluateObservationDensities();
56 
57  virtual void EvaluateImportanceWeights();
58 
59  /** The area for the initial uniform distribution.
60  Probably image size...
61  */
62  void SetArea(Vector2<double> min, Vector2<double> max);
63 
64  /** converts to Image<float> and calls the function above */
65  void SetObservation(Image<unsigned char> &osbImg);
66 
67  /* at every (rounded) sample position, the sampleImg is set
68  to UCHAR_MAX */
69  void GetSamplePositions(Image<unsigned char> &sampleImg);
70 
71  /** this draws the sample weights as circles
72  */
73  void DrawSamples(Image<unsigned char> &img,
74  unsigned char value=255);
75 
76  /** Draws the samples with their weight as greyvalue,
77  the weight is distributed to the 4 pixels around the sample postion.
78  Image has to be initialized with correct size and channelcount !
79  */
80  void DrawPosteriorDistribution(BIAS::Image<unsigned char> &img);
81 
82  /** same as above but float precision and
83  returns the maximum value also.
84  */
85  double DrawPosteriorDistribution(BIAS::Image<float> &img);
86 
87 
88  /** Draws the mean as a cross, which size is proportional to the variance
89  */
90  void DrawMean(BIAS::Image<unsigned char> &img);
91 
92 protected:
95 
96  // needed for DrawPosteriorDistribution()
98 
99 };
100 
101 }
102 
103 #endif
Vector< double > areaMin_
Definition: CondensImg.hh:93
CONDENSATION (CONditional DENSity EstimATION) is a state estimator very similiar to the Kalman Filter...
Definition: Condensation.hh:81
CondensImg()
u have to set the stateDim in the constructor!
Definition: CondensImg.hh:49
example class for condensation with a 2-dim state vector.
Definition: CondensImg.hh:44
Image< unsigned char > obsImg_
Definition: CondensImg.hh:94
BIAS::Image< float > fImg_
Definition: CondensImg.hh:97