visageSDK
FDP.h
1 //
3 // (c) Visage Technologies AB 2002 - 2023 All rights reserved.
4 //
5 // This file is part of visage|SDK(tm).
6 // Unauthorized copying of this file, via any medium is strictly prohibited.
7 //
8 // No warranty, explicit or implicit, provided.
9 //
10 // This is proprietary software. No part of this software may be used or
11 // reproduced in any form or by any means otherwise than in accordance with
12 // any written license granted by Visage Technologies AB.
13 //
15 
16 
17 #ifndef __FDP_h__
18 #define __FDP_h__
19 
20 // C++
21 #include <string>
22 
23 #include "Base.h"
24 
25 #ifdef VISAGE_STATIC
26  #define VISAGE_DECLSPEC
27 #else
28 
29  #ifdef VISAGE_EXPORTS
30  #define VISAGE_DECLSPEC __declspec(dllexport)
31  #else
32  #define VISAGE_DECLSPEC __declspec(dllimport)
33  #endif
34 
35 #endif
36 
37 namespace VisageSDK
38 {
39 
51 struct VISAGE_DECLSPEC FeaturePoint
52 {
53 
54 public:
55 
61  float pos[3];
62 
70  int defined;
71 
79  int detected;
80 
90  float quality;
91 
97  int vert;
98 
103  std::string surf;
104 
105  int animated;
106  int normalizing;
107 
108  FeaturePoint()
109  {
110  quality = -1;
111  defined = 0;
112  detected = 0;
113  surf = "";
114  vert = -1;
115  animated = normalizing = 0;
116  pos[0] = 0.0f;
117  pos[1] = 0.0f;
118  pos[2] = 0.0f;
119  }
120 
121  FeaturePoint( const FeaturePoint& fp )
122  {
123  quality = fp.quality;
124  pos[0] = fp.pos[0];
125  pos[1] = fp.pos[1];
126  pos[2] = fp.pos[2];
127  defined = fp.defined;
128  detected = fp.detected;
129  animated = fp.animated;
130  normalizing = fp.normalizing;
131  surf = fp.surf;
132  vert = fp.vert;
133  }
134 
135  FeaturePoint& operator=( const FeaturePoint& fp )
136  {
137  if( this == &fp )
138  return *this;
139 
140  pos[0] = fp.pos[0];
141  pos[1] = fp.pos[1];
142  pos[2] = fp.pos[2];
143  quality = fp.quality;
144  defined = fp.defined;
145  detected = fp.detected;
146  animated = fp.animated;
147  normalizing = fp.normalizing;
148  surf = fp.surf;
149  vert = fp.vert;
150 
151  return *this;
152  }
153 };
154 
191 class VISAGE_DECLSPEC FDP
192 {
193 public:
194 
199  FDP();
200 
205  FDP( const FDP& featurePoints );
206 
211  FDP( const char *fn );
212 
213  /*
214  * Destructor.
215  */
216  ~FDP();
217 
218  /*
219  * Assignment operator.
220  */
221  FDP& operator=( const FDP& featurePoints );
222 
230  int readFromFile(const char *name);
231 
236  void createNewFile(const char *name);
237 
242  void saveToFile() const;
243 
248  void saveToFile(const char *fileName);
249 
256  const FeaturePoint& getFP(int group, int n) const;
257 
263  const FeaturePoint& getFP(const char *name) const;
264 
272  void setFP( int group, int n, const FeaturePoint& f );
273 
279  void setFP( const char* name, const FeaturePoint& f );
280 
288  const float* getFPPos(int group, int n) const;
289 
295  const float* getFPPos(const char *name) const;
296 
304  float getFPQuality(int group, int n) const;
305 
311  float getFPQuality(const char *name) const;
312 
319  void setFPQuality(int group, int n, const float quality);
320 
326  void setFPQuality(const char *name, const float quality);
327 
334  void setFPPos(int group, int n, const float *pos);
335 
341  void setFPPos(const char *name, const float *pos);
342 
351  void setFPPos(int group, int n, float x, float y, float z);
352 
360  void setFPPos(const char *name, float x, float y, float z);
361 
370  bool getFPSurfVert( int group, int n, std::string& surf, int& vert ) const;
371 
379  bool getFPSurfVert( const char* name, std::string& surf, int& vert ) const;
380 
388  void setFPSurfVert(int group, int n, const std::string& surf, int vert);
389 
396  void setFPSurfVert(const char *name, const std::string& surf, int vert);
397 
403  void reset();
404 
413  bool FPIsDefined( int group, int n ) const;
414 
422  bool FPIsDefined( const std::string& name ) const;
423 
432  bool FPIsDetected(int group, int n) const;
433 
441  bool FPIsDetected(const std::string& name) const;
442 
443 
444  /*
445  * Returns true if the face is normalized.
446  */
447  bool isNormalized() const;
448 
449  /*
450  * Returns true if the face is initialized.
451  */
452  bool isInitialized() const;
453 
458  static const int FP_START_GROUP_INDEX = 2;
459 
464  static const int FP_END_GROUP_INDEX = 17;
465 
469  static const int FP_NUMBER_OF_GROUPS = 16;
470 
471 private:
472 
473  /*
474  * FDP file name.
475  */
476  char mFilename[192];
477 
481  float MNS0,ENS0,ES0,MW0,IRISD0;
482 
486  bool normalized;
487 
491  FeaturePoint *fp[FP_END_GROUP_INDEX+1];
492 
493  /*
494  * Print feature point definitions to console.
495  */
496  void print() const;
497 
501  bool initialized;
502 
503 
504 public:
505 
513  static void parseFPName( const std::string& name, int& group, int& n );
514 
523  static std::string getFPName( int group, int n );
524 
533  static bool FPIsValid( int group, int n );
534 
543  static bool FPIsValid( const std::string& name );
544 
545  enum pointTypes { PT_LEFT = 1, PT_CENTRAL = 2, PT_RIGHT = 3, PT_UNDEFINED = -1 };
546 
547  static pointTypes getPointType(int group, int index);
548 
549 private:
550 
554  static const int groupSizes[FP_NUMBER_OF_GROUPS];
555 
556 public:
557 
566  static int groupSize( int group );
567 
568 
577  static int getMirrorPointIndex(int group, int index);
578 };
579 
580 }
581 
582 #endif // __FDP_h__
Feature point.
Definition: FDP.h:51
int defined
Set with regards to the 3D model used.
Definition: FDP.h:70
int detected
Set with regards to the tracking algorithm used.
Definition: FDP.h:79
std::string surf
Identifier of the polygon mesh (surface) to which the vertex corresponding to the feature point belon...
Definition: FDP.h:103
float pos[3]
Position.
Definition: FDP.h:61
Namespace.
Definition: android_header.h:1
float quality
Information about the accuracy of the tracking algorithm for this feature point in the current frame...
Definition: FDP.h:90
int vert
Identifier of the vertex to which the vertex corresponding to the feature point belongs.
Definition: FDP.h:97
Feature points of a face.
Definition: FDP.h:191