visageSDK
FBFT.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 //FBFT.h
17 //declaration of the face tracker class
18 
19 #ifndef FBFT_H
20 #define FBFT_H
21 
22 //#define _CRTDBG_MAP_ALLOC //MEMORY LEAK DEBUGGING
23 //#include <stdlib.h>
24 //#include <crtdbg.h>
25 
26 
27 // The following ifdef block is the standard way of creating macros which make exporting
28 // from a DLL simpler. All files within this DLL are compiled with the VISAGETRACKER_EXPORTS
29 // symbol defined on the command line. this symbol should not be defined on any project
30 // that uses this DLL. This way any other project whose source files include this file see
31 // VISAGE_DECLSPEC functions as being imported from a DLL, wheras this DLL sees symbols
32 // defined with this macro as being exported.
33 
34 
35 #ifdef VISAGE_STATIC
36  #define VISAGE_DECLSPEC
37 #else
38 
39  #ifdef VISAGE_EXPORTS
40  #define VISAGE_DECLSPEC __declspec(dllexport)
41  #else
42  #define VISAGE_DECLSPEC __declspec(dllimport)
43  #endif
44 
45 #endif
46 
47 #define SOFTWARE_RENDERING
48 #ifdef SOFTWARE_RENDERING
49 #include "SwrTexture.h"
50 #endif
51 // define to use Extended Information Filter
52 
53 #include <cv.h>
54 #include <string>
55 
56 #ifdef EMSCRIPTEN
57 #include <cstddef>
58 #include <vector>
59 #else
60 #include <highgui.h>
61 #endif
62 
64  // definitions from EKF.h
65  #define LIMIT_R_VALUE 100000.0f //points whose R value is bigger or equal to this value are not processed
66 
67  //from types.h (FaceTracker 2)
68  typedef float f32;
69  typedef double f64;
70  typedef char is8;
71  typedef unsigned char iu8;
72  typedef short int is16;
73  typedef unsigned short int iu16;
74  typedef int is32;
75  typedef unsigned int iu32;
76  typedef long int is64;
77  typedef unsigned long int iu64;
78 
79 #include "ExtendedInformationFilter.h"
80 #include "FaceModelNoVel.h"
82 
83 #include "FDP.h"
84 
85 //from func.h
86 #include <fstream>
87 #include <sstream>
88 
89 //face normalization
90 #define VS_NORM_POSE 0x00
91 #define VS_NORM_SU 0x01
92 #define VS_NORM_AU 0x02
93 
94 //from func_gl.h
95 
96 #if defined(WIN32)
97 #define NOMINMAX
98 #include <windows.h>
99 //#define ENABLE_OPENGL
100 #ifdef ENABLE_OPENGL
101 #include <GL/gl.h>
102 #include <GL/glu.h>
103 #endif
104 #endif
105 
106 #if defined(MAC_OS_X)
107 #define ENABLE_OPENGL
108 #ifdef ENABLE_OPENGL
109 #include <OpenGL/OpenGL.h>
110 #include <OpenGL/glu.h>
111 #endif
112 #endif
113 
114 #if defined(LINUX)
115 #define ENABLE_OPENGL
116 #ifdef ENABLE_OPENGL
117 #include <GL/gl.h>
118 #include <GL/glu.h>
119 #endif
120 #endif
121 
122 using namespace std;
123 
124 namespace VisageSDK
125 {
126 
127 class VisageDetector;
128 class VisageTracker;
129 struct FaceData;
130 
137 class VISAGE_DECLSPEC FBFT
138 {
139 
140 friend class VisageDetector;
141 friend class VisageTracker;
142 friend class VisageFeaturesDetector;
143 friend class ModelFitter;
144 friend class PoseEstimator;
145 
146 public:
147  //constructor
148  FBFT (
149  );
150 
151  //destructor
152  ~FBFT (
153  );
154 
155 private:
156 
157  //initialisation
158  bool init (
159  const string &settings //settings to be used
160  );
161  void init_image_sizes (
162  const string &settings, //settings to be used
163  iu32 frame_width, //width of video image
164  iu32 frame_height //height of video image
165  );
166 
167  void reInitialiseFromEyeAndMouthPos(IplImage* frame,FDP *fp);
168  void fitModelToFeaturePoints(FDP *fp,int imageWidth, int imageHeight);
169  void calculatePose(FDP *fp, float *rot, float *tran,float aspect,float &s,float &edi,float &end, float &emd);
170 
171  //initiate tracker with a first frame, update tracker with a new frame, or just project the vertices
172  void update (
173  /*const */IplImage* frame, //a frame, if 0 only projection is done
174  bool track //0: initiate tracker with first frame, 1: update tracker with new frame
175  );
176  //check if r, t or au are out of their boundaries
177  bool bad_states (
178  );
179  //initiate feature points using a frame, should be private
180  bool init_feature_points (
181  const IplImage* frame //frame used to extract feature points
182  );
183  //find feature points in a masked image
184  int find_good_feature_points (
185  const IplImage* image_color, //color image
186  const IplImage* mask, //the mask
187  iu32 ROI_index //current ROI
188  );
189  //set predefined feature points
190  int set_feature_points (
191  iu32 ROI_index //current ROI
192  );
193 
194  //find_point for all feature points
195  void find_points (
196  CvMat* search_range,
197  CvMat* method, // matching method to use
198  f32* maximum_values, // array to store maximum match values for each point, normalised with respect to initial values
199  iu32* use_tex, // flag for each point, if 1 textured image is used for search, if 0 previous frame is used
200  iu32* point_visible, // flag for each point, if 1 point is visible, if 0 point is hidden so don't try to find it
201  bool refine_step = false
202  );
203 
204  // Estimate eye closure based on iris match values
205  void processEyesClosure(IplImage* frame, FDP* fdp, float* out);
206 
207  // compute the valuse of the eye closing AU that performs full eye closing
208  void compute_full_eye_closure();
209 
210  //set the ekf R values depending on the result of feature point matching
211  void set_ekf_R (
212  f32* _max_vals
213  );
214  // resize the data matrices for the current number of tracked featured points
215  void resize (
216  iu32 _points_num
217  );
218 
219  //model
220  CvMat* g; //fix model vertices
221  CvMat* g0; //original version of fix model vertices, needed for re-initialisation
222  CvMat* Su; //shape unit matrix
223  CvMat* Au; //action unit matrix
224  CvMat* tri; //model surface triangles
225  CvMat* au_use; //list of action units actually to use, boolean behaviour
226  string* au_names;//list of action units names, currently not used //can be used with au_num to determine max array size //added by Pilipovic
227  size_t au_names_count;
228  f32 f; // Camera focus
229  f32 s; //scale
230  f32 r[3]; //array of xyz rotation angles
231  f32 t[3]; //array of xyz translations
232  f32 r_prev[3]; //array of xyz previous frame rotation angles
233  f32 t_prev[3]; //array of xyz previous frame translations
234  f32 tzinit; //z translation at initialisation
235  f32 dIinit; //eye distance in projection space at initialisation
236  CvMat* su; //shape unit vector
237  CvMat* au; // action unit vector
238  CvMat* vertex0; //model vertices after shape and action units have been added
239  CvMat* vertex1; //model vertices after scaling, rotation and translation
240  CvMat* vertexN; //model vertices in neutral face
241 public:
242  CvMat* projection; // Projected model vertices. The 2D coordinates of the model vertices projected onto the display window. The coordinates are normalised to the window height: 0,0 is in the center of the window; Y coordinate of the upper edge is 1, Y coordinate of the lower edge is -1, X coordinate of the left edge is equal to -aspect ratio of the image, and the X coordinate of the right edge is equal to the aspect ratio of the image.
243 #ifdef EMSCRIPTEN
244 public:
245 #else
246 //private:
247 #endif
248  CvMat* current_tex_coord; //current texture coordintes; calculated on demand by getTexCoord(). These coordinates are a simple normalisation of coordinates in projection
249  //texture
250  iu32 tex_size; //size of the texture (size times size pixels, size = power of 2)
251  CvMat** tex_coord; //texture coordinates, one CvMat* for each used texture
252  iu32 tex_num; //number of textures used
253  CvMat* tri_tex; //texture name (index) for each triangle
254  //point finding
255  iu32 gl_width; //width of opengl buffer
256  iu32 gl_height; //height of opengl buffer
257  iu32 fast_image_resize;
258  iu32 init_gl_width; //width of opengl buffer for initialisation (feature points choosing)
259  iu32 init_gl_height; //height of opengl buffer for initialisation (feature points choosing)
260  iu32 ROI_num; //number of Regions of Interest (ROI)
261  CvMat* min_distance; //the wanted minimum distance between feature points (float, one per ROI)
262  CvMat* block_size; //size of averaging block used in opencv func to extract feature points (int, one per ROI)
263  CvMat** tri_index; //list of triangle indices forming the mask in which feature points may be inserted (list of integers, one list per ROI)
264  CvMat* bound_rect_modifiers; //mask bounding rectangle modifiers, float, four per ROI
265  CvMat* max_points_num_ROI; //maximum number of feature points to use for each ROI, int
266  CvMat* ROI_init_angle; //ROI track points initialisation angle (float, one per ROI)
267  CvMat* ROI_initialised; //Flag indicating if the ROI track points have been initialised (int, one per ROI)
268  iu32 max_points_num; //maximum number of feature points to use in total, for all ROIs
269  iu32 points_num; // number of feature points actually used
270  iu32 model_points_num; // number of points (vertices) in the 3D model itself (without the track points)
271  iu32 reserved_points_num; // number of feature points that are allocated but not yet used
272  CvMat* preset_points_coord; //set feature point coordinates
273  CvMat* points_preset; // indexes to array with preset points mapping
274  CvMat* eye_points_coord;
275  CvMat* preset_points_ROI;
276  CvMat* points_coord; //feature point coordinates
277  CvMat* points_ROI; //feature point ROI indices, one int per tracked feature point
278  CvMat* search_range; //search range (int, two per ROI - x and y) when using prev image to search for feature points
279  CvMat* refine_range; //search range (int, two per ROI - x and y) when using drawn model to search fro feature points
280  CvMat* patch_size; //size of the patch (float, one per ROI) to match with (patch_size times patch_size pixels)
281  CvMat* method; //matching method (int, one per ROI)
282  CvMat* bad_match_threshold; // minimal match value for a track point (float, one per ROI); corrective action taken when match value falls below threshold
283  f32 global_bad_match_threshold; // minimum average match value for all track points; if value is below this threshold the tracker will re-initialise
284  iu32 visibility_check; // are we doing visibility check? 0 = no; 1 = normals; 2 = color coding; 3 = both
285  CvMat* sensitivity_falloff; // a parameter that controls how fast the tracker sensitivity to a particular track point decreases when the match quality for that point decreases (float, one per ROI). Higher values result in sharper falloff, i.e. by increasing this value the tracker increasingly ignores points with bad match values.
286  f32* max_vals; // match quality values for each feature point, expressed as ratio to the value from the first frame
287  f32* tex_max_vals; // match quality values from texture-based matching for each feature point, expressed as ratio to the value from the first frame
288  float tracking_quality; // match quality average for this frame
289  float tracking_quality_bdts; // bdts quality average for this frame
290  IplImage* prev_frame; //the previous frame
291  IplImage* cur_frame; //the current frame
292  IplImage* prev_frame_full; //the current frame
293  iu32 n_recovery_frames; // number of recovery frames to be used
294  iu32 recovery_frames; // recovery frames counter
295  FDP *fp_corres; // FDP structure used to store correspondence between MPEG-4 Feature Points and vertices in the 3D model
296  VisageTracker *vt;
297  float* init_angle_hyst;
298 
299  // eye processing stuff
300  iu32 process_eyes; // process eye rotation and closure
301  f32 full_eye_closure; // value of eye closure AU corresponding to full eye closure; set automatically when initialising, after the 3D model has been fitted
302  iu32 eye_closing_au;
303  iu32 leye_closing_au; // AU that closes the eyes; candide hardcoding - should be configurable
304  iu32 reye_closing_au;
305  iu32 eye_h_rotation_au; // AU that horizontaly the eyes; candide hardcoding - should be configurable
306  iu32 eye_v_rotation_au; // AU that horizontaly the eyes; candide hardcoding - should be configurable
307  float eye_closure[2];
308 
309  //working images
310  IplImage* gl_image_color;
311  IplImage* image_color;
312  IplImage* image_index;
313  IplImage* image;
314  IplImage* patch_image_tex; // patch image created by projecting the textured model
315 
316  iu32 frame_tex_id;
317  f32 tex_x_coord;
318  f32 tex_y_coord;
319 
320  IplImage* result_image_buffer;
321 
322  // interpupillary distance
323  float ipd;
324  void setIPD(float value);
325  float getIPD();
326 
327  float face_scale;
328 
329  void setTMSizes(FDP* featurePoints2D);
330 
331  static const float EYE_OPEN_THRESHOLD;
332 
333  // n3
334  /*
335  for EIF implementation
336  */
337  SystemModel* n3Sys;
338  FaceModel* n3Fm;
340  unsigned int frame_num;
341 
342  void n3_eif_init();
343  void n3_eif_reset(const f32* r, const f32* t, const CvMat* au);
344  void n3_extract_data(float r[3], float t[3], CvMat* au, CvMat* x);
345 
346  /*
347  ...
348  */
349 
350  bool ekf_failure; // set to true when EKF update fails
351  CvMat* ekf_sensitivity; //the ekf sensitivity for 3 rotations, 3 translations and 14 AUs
352  CvMat* au_gravity; //A gravity factor, one per each Action Unit, that determines the behavior of the Action Unit in the situation when it is not driven by track points because they are not found (e.g. they are hidden or temporarily lost). In such case, AU value is multiplied by the gravity factor. Therefore, gravity factor 1 is neutral, less than 1 means that AU value will fall (faster if gravity factor is smaller), and a value larger than 1 would make the AU value rise.
353  f32 gravity_threshold; //Threshold value that determines when the gravity factor starts to influence the Action Units. Then the Kalman gain for all track points influencing the AU falls below this threshold, gravity kicks in.
354  CvMat* points_au; //An integer matrix of au_num rows and points_num columns determining which track points drive which AU by values of 1 or 0.
355  CvMat* points_Au; //For each track point, a value of 0 indicates that it does not drive any AUs, value is 1 otherwise.
356  CvMat* points_tri; //Triangle index for each track point.
357  CvMat* r_limit; //rotation boundaries
358  CvMat* t_limit; //translation boundaries
359  CvMat* au_limit; //action unit boundaries
360 
361  VisageDetector* m_DetectorBDF;
362  FDP *featurePoints2D;
363 
364  int face_bb_x;
365  int face_bb_y;
366  int face_bb_x_prev;
367  int face_bb_y_prev;
368  int face_bb_size;
369  int max_face_width;
370  int face_bb_init;
371  float face_bb_scale;
372  int max_work_eye_dist;
373  int cur_eye_dist;
374  IplImage *face_bb_new;
375  IplImage *face_bb_prev;
376  IplImage *face_bb_tex;
377  CvRect face_bb_rect;
378  CvRect face_bb_rect_scaled;
379 
380  FDP *fitter_offset;
381 
382  f32 find_point_new (
383  IplImage* image, //image B
384  CvSize search_image_size, //search image size
385  IplImage* patch_image, //image A
386  CvSize patch_image_size, //patch image size
387  IplImage* result_image, //matching results
388  f32 patch_x, //feature point coordinate u
389  f32 patch_y, //feature point coordinate v
390  f32 &x_find, //new feature point coordinate u, output
391  f32 &y_find, //new feature point coordinate v, output
392  iu32 method, //matching method to use
393  iu32 tex_use // are we using texture or previous frame?
394  );
395 
396  void estimate_eye_rotations (
397  float f,
398  float s,
399  const float* r,
400  const float* t,
401  const CvMat* su,
402  const CvMat* au,
403  const CvMat* g,
404  const CvMat* Su,
405  const CvMat* Au,
406  CvMat* vertex0,
407  CvMat* vertex1,
408  int* eye_ind = 0
409  );
410 
411  float r_eye[2]; //eye rotations
412 
413  int m_bdts_points_num;
414  iu32 m_use_bdts_points;
415  int m_bdts_points_inited;
416 
417  CvMat* bdts_points_use;
418  CvMat* bdts_points_sensitivity;
419  CvMat* bdts_points_angle;
420  CvMat* bdts_points_nptrb;
421 
422  void find_bdts_points(IplImage* frame, FDP* fdp, CvPoint2D32f* points, float *vals);
423  void init_bdts_points(IplImage* frame, FDP* fdp);
424 
425  int m_LBFPointsNum;
426  iu32 m_useLBFPoints;
427  float m_LBFPointsAngle;
428  int m_LBFPointsInited;
429 
430  void findLBFPoints(IplImage* frame, FDP* fdp, CvPoint2D32f* points, float* vals);
431  void initLBFPoints(IplImage* frame, FDP* fdp);
432 
433  void setFDPPointVisibility(const FDP* fdp, FDP& fdp_vis) const;
434 
435  void GetQualityNCC(CvPoint2D32f* cur_points, CvPoint2D32f* prev_points, IplImage* cur_frame, IplImage* prev_frame, float* quality, int point_num, int patch_size);
436  IplImage* lbf_ncc_patches;
437  bool *lbf_ncc_use_last;
438  int *lbf_ncc_frame_diff;
439  int *lbf_ncc_patchsize;
440 
441  FILE *log_file; //log file - used for debugging, set via log_filename configuration parameter
442 
443 #pragma region READ_WRITE
444 
445  //from func.h
446 
447  //read a file into a string, returns the string
448  string read_file (
449  const string &filename //the filename
450  );
451 
452  //write the contents of a string to a file
453  void write_file (
454  const string &filestring, //the string to be written
455  const string &filename //the filename
456  );
457 
458  //read a wfm file containing face model data
459  bool read_gSuAu_wfm (
460  const string &file_name //the filename
461  );
462 
463  //read profile from string
464  void read_profile (
465  const string &filestring, //the string
466  string &texture // texture image file name, output
467  );
468 
469  //write scale and shape units to file
470  void write_profile (
471  const string &filename,
472  IplImage* texture_image // texture image
473  );
474 
475  //read rotation, translation and action units from string
476  void read_states (
477  const string &filestring, //the string
478  f32* r, //3 sized array of xyz rotation angles
479  f32* t, //3 sized array of xyz translations
480  CvMat* au //action unit vector
481  );
482 
483  //write rotation, translation and action units to string, returns the string
484  string write_states (
485  const f32* r, //3 sized array of xyz rotation angles, output
486  const f32* t, //3 sized array of xyz translations, output
487  const CvMat* au //action unit vector, output
488  );
489 
490  //read a setting from a setting string, integer
491  void read_setting (
492  const string &settings, //setting string
493  const string name, //setting name
494  iu32 &value //setting value, output
495  );
496 
497  //read a setting from a setting string, floating point
498  void read_setting (
499  const string &settings, //setting string
500  const string name, //setting name
501  f32 &value //setting value, output
502  );
503 
504  //read a setting from a setting string, text
505  void read_setting (
506  const string &settings, //setting string
507  const string name, //setting name
508  string &value //setting value, output
509  );
510 
511  //read a setting list (vector) from a setting string, floating point
512  void read_settings_list_f32 (
513  const string &settings, //setting string
514  const string name, //setting name
515  CvMat* list //list (vector) of values, output
516  );
517 
518  //read a setting list (vector) from a setting string, integer
519  void read_settings_list_iu32 (
520  const string &settings, //setting string
521  const string name, //setting name
522  CvMat* list //list (vector) of values, output
523  );
524 
525  //read a setting array from a setting string, integer
526  void read_setting_array (
527  const string &settings, //setting string
528  const string name, //setting name
529  const iu32 n, //size of array
530  int *value //setting value array, output
531  );
532 
533  //read a setting array from a setting string, floating point
534  void read_setting_array (
535  const string &settings, //setting string
536  const string name, //setting name
537  const iu32 n, //size of array
538  const iu32 l, //size of each row
539  float *value, //setting value array, output
540  bool default_first //if true, default value for any setting that was not found is taken from the first member of array; if false, default values are 0
541  );
542 
543  //read a setting array from a setting string, returns string array of @param size elements
544  void read_settings_list_string(
545  const string &settings, //setting string
546  const string name, //setting name
547  int size,
548  string *list //list of names, output
549  );
550 
551 #pragma endregion READ_WRITE
552 
553 #pragma region GL
554 
555  //from func_gl.h
556 
557  void gl_swap_rb (
558  IplImage* image
559  );
560 
561  //set the camera and its view (frustum)
562  void gl_view (
563  iu32 width, //width of image to be drawn
564  iu32 height, //height of image to be drawn
565  f32 f //focus
566  );
567 
568  //initialize frame texture
569  void gl_init_frame_tex (
570  iu32 x_size,
571  iu32 y_size,
572  const IplImage *image
573  );
574 
575  //display video as texture
576  void gl_display_video (
577  iu32 width,
578  iu32 height,
579  const IplImage *image
580  );
581 
582  //load an image to the buffer
583  void gl_load_image (
584  const IplImage* image //the image to load
585  );
586 
587  //save the buffer to an image
588  void gl_save_image (
589  IplImage* image //image to save to, output
590  );
591 
592  //fix model vertices + shape action units + scale rotation translation + projection -> image coordinates
593  void gl_project (
594  f32 f, //focus
595  f32 s, //scale
596  const f32* r, //3 sized array of xyz rotation angles
597  const f32* t, //3 sized array of xyz translations
598  const CvMat* su, //shape unit vector
599  const CvMat* au, //action unit vector
600  const CvMat* g, //fix model vertex list
601  const CvMat* Su, //shape unit matrix
602  const CvMat* Au, //action unit matrix
603  CvMat* vertex0, //model vertices after shape and action units have been added, output
604  CvMat* vertex1, //model vertices after scaling, rotation and translation, output
605  CvMat* projection //projected model vertices, output
606  );
607 
608  //compute and return texture coordinates
609  const float *getTexCoord(float aspect);
610 
611  //load an image as an opengl texture and calculate texture coordinates from projection
612  void gl_set_texture (
613  const IplImage* image, //the texture image
614  iu32 tex_size, //size of the texture (size times size pixels, size = power of 2)
615  iu32 tex_name, //number to bind texture with
616  const CvMat* projection, //projected model vertices
617  CvMat** tex_coord //texture coordinates, output
618  );
619 
620  //draw selected model triangles using their index number (32bit using 3x8bit)
621  void gl_draw_model_tri_index (
622  iu32 width, //width of drawn image
623  iu32 height, //height of drawn image
624  f32 f, //focus
625  const CvMat* vertex1, //model vertices after scaling, rotation and translation
626  const CvMat* tri, //model surface triangles
627  const CvMat* tri_index //list of triangle indices
628  );
629 
630  //draw selected model triangles using a specific color
631  void gl_draw_model_tri (
632  iu32 width, //width of drawn image
633  iu32 height, //height of drawn image
634  f32 f, //focus
635  const CvMat* vertex1, //model vertices after scaling, rotation and translation
636  const CvMat* tri, //model surface triangles
637  const CvMat* tri_index, //list of triangle indices
638  const f32* color //3 sized array containing the color
639  );
640 
641  //draw textured model
642  void gl_draw_model_texture (
643  iu32 width, //width of drawn image
644  iu32 height, //height of drawn image
645  f32 f, //focus
646  const CvMat* vertex1, //model vertices after scaling, rotation and translation
647  const CvMat* tri_index, //list of triangles to draw, indicated by triangle index, or NULL to draw all triangles
648  const CvMat** tex_coord //list of texture coordinates for the vertices; one list for each used texture
649  );
650 
651  //draw model as a wireframe using a specific color
652  void gl_draw_model_wireframe (
653  iu32 width, //width of drawn image
654  iu32 height, //height of drawn image
655  f32 f, //focus
656  const CvMat* vertex1, //model vertices after scaling, rotation and translation
657  const CvMat* tri, //model surface triangles
658  const f32* color //3 sized array containing the color
659  );
660 
661  //draw model vertices starting from a specific vertex index using a specific color
662  void gl_draw_points (
663  iu32 width, //width of drawn image
664  iu32 height, //height of drawn image
665  f32 f, //focus
666  const CvMat* vertex1, //model vertices after scaling, rotation and translation
667  iu32 first_point, //the first vertex index
668  iu32 num_points, //number of points to draw
669  const f32* color, //3 sized array containing the color
670  f32 point_size, //size in pixels of the drawn points representing the vertices
671  f32 *color_multiplier // one value per point, multiplies the color of that point; ignored if NULL
672 
673  );
674 
675 #pragma endregion GL
676 
677 #pragma region SOFTWARE RENDERING
678 
679  #ifdef SOFTWARE_RENDERING
680  #define MAX_SWR_TEX 30
681  SwrTexture *swr_texture[MAX_SWR_TEX];
682 
683  unsigned short *zBuffer16;
684  int swrWidth;
685  int swrHeight;
686  char *imageData;
687  unsigned short *imageData16;
688 
689  void swr_load_image (
690  const IplImage* image
691  );
692 
693  void swr_save_image (
694  IplImage* image
695  );
696 
697  void swr_set_texture (
698  const IplImage* image,
699  iu32 tex_size,
700  iu32 tex_name,
701  const CvMat* projection,
702  CvMat** tex_coord
703  );
704 
705  void swr_draw_model_tri_index (
706  iu32 width,
707  iu32 height,
708  f32 f,
709  const CvMat* vertex1,
710  const CvMat* tri,
711  const CvMat* tri_index
712  );
713 
714  void swr_draw_model_texture (
715  iu32 width,
716  iu32 height,
717  f32 f,
718  const CvMat* vertex1,
719  const CvMat* tri_index,
720  const CvMat** tex_coord
721  );
722 
723  void getNormalizedFaceImage (
724  IplImage* frame,
725  IplImage* normFace,
726  f32 f,
727  const CvMat* vertex,
728  const CvMat* tri_index,
729  const CvMat* tex_coord
730  );
731 
732  void getNormalizedFace(
733  IplImage* frame,
734  IplImage* normFace,
735  FaceData* face_data,
736  FDP* normFDP,
737  int norm_type,
738  CvMat* projection_tmp
739  );
740 
741  #endif
742 
743 #pragma endregion SOFTWARE RENDERING
744 
745 };
746 
747 }
748 
749 #endif
VisageTracker is a face tracker capable of tracking the head pose, facial features and gaze for multi...
Low-level face tracker implementation used in VisageTracker.
Definition: FBFT.h:137
Faces and facial features detector implementation.
Namespace.
Definition: win_header.h:1
Face data structure, used as container for all face tracking and detection results.
Definition: FaceData.h:259
Feature points of a face.
Definition: FDP.h:191