Frapper  1.0a
FaceTrackerNode.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of FRAPPER
4 research.animationsinstitut.de
5 sourceforge.net/projects/frapper
6 
7 Copyright (c) 2008-2009 Filmakademie Baden-Wuerttemberg, Institute of Animation
8 
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU Lesser General Public License as published by the Free Software
11 Foundation; version 2.1 of the License.
12 
13 This program is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16 
17 You should have received a copy of the GNU Lesser General Public License along with
18 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20 http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
21 -----------------------------------------------------------------------------
22 */
23 
33 
34 #ifndef FACETRACKERNODE_H
35 #define FACETRACKERNODE_H
36 
37 #include "opencvColorInput.h"
38 #include "ParameterGroup.h"
39 #include <QtCore/QVariant>
40 #include <QtCore/QTime>
41 #include <QtCore/QThread>
42 #include <QtCore/QMutex>
43 #include <QtCore/QTimer>
44 
45 #include <vector>
46 
47 #include "Face.h"
48 #include "Helper.h"
49 
50 namespace FaceTrackerNode {
51 using namespace Frapper;
52 using namespace cv;
53 
58 class FaceTrackerNode : public opencvColorInput //, public QThread
59 {
60 
61  Q_OBJECT
62 
63 public:
64 
70  FaceTrackerNode ( QString name, ParameterGroup *parameterRoot );
71 
72 public:
73 
77  ~FaceTrackerNode ();
78 
79 public:
80 
81  //virtual void run();
82 
83 public slots:
84 
85 private slots:
86 
90  void flipPicture();
91 
95  void probability();
96 
100  void switchTime();
101 
105  void switchTimeRand();
106 
110  void randomLook();
111 
115  void focusPointSpeed();
116 
120  void focusPointMoveLimit();
121 
125  void switchUserNow();
126 
130  void minSize();
131 
135  void maxSize();
136 
140  void drawDebugInformation();
141 
145  virtual void processInputMatrix();
146 
147 private:
148 
149 
150 
151 
152 
153  void detectFaces(cv::Mat image);
154 
160  void drawDetectedFaces(cv::Mat image);
161 
167  void drawDebugInfo(cv::Mat image);
168 
173  void decreaseProbabilities();
174 
179  void processAttractors();
180 
184  void animateFocusPoint();
185 
186 
187 
188 private:
189 
193  QMutex m_mutex;
194 
198  QTimer m_timer;
199 
203  QTime m_timestamp;
204 
209 
214 
218  std::vector<Face *> m_faces;
219 
223  std::vector<Attractor> m_attractors;
224 
229 
234 
239 
244 
249 
253  vector<cv::Rect> m_detectedObjects;
254 
258  cv::CascadeClassifier *m_cascadeClassifier;
259 
264 
269 
274 
279 
283  unsigned int delay;
284 
288  unsigned int attractorCount;
289 
294 
299 
304 
309 
314 
319 
324 
329 
334 
338  double m_minSize;
339 
343  double m_maxSize;
344 
349 
350 };
351 
352 } // namespace FaceTrackerNode
353 
354 #endif