Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * FacerInterface.h - Fawkes BlackBoard Interface - FacerInterface 00004 * 00005 * Templated created: Thu Oct 12 10:49:19 2006 00006 * Copyright 2008 Tim Niemueller 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #ifndef __INTERFACES_FACERINTERFACE_H_ 00025 #define __INTERFACES_FACERINTERFACE_H_ 00026 00027 #include <interface/interface.h> 00028 #include <interface/message.h> 00029 #include <interface/field_iterator.h> 00030 00031 namespace fawkes { 00032 00033 class FacerInterface : public Interface 00034 { 00035 /// @cond INTERNALS 00036 INTERFACE_MGMT_FRIENDS(FacerInterface) 00037 /// @endcond 00038 public: 00039 /* constants */ 00040 00041 /** 00042 This determines the current status of skill execution. 00043 */ 00044 typedef enum { 00045 OPMODE_DISABLED /**< Facer will not process any images */, 00046 OPMODE_DETECTION /**< Facer will detect faces, but not try to recognize them. */, 00047 OPMODE_RECOGNITION /**< Facer will detect faces, and then try to recognize the most dominant face. */, 00048 OPMODE_LEARNING /**< Facer will gather images and learn an identity. */ 00049 } if_facer_opmode_t; 00050 const char * tostring_if_facer_opmode_t(if_facer_opmode_t value) const; 00051 00052 private: 00053 #pragma pack(push,4) 00054 /** Internal data storage, do NOT modify! */ 00055 typedef struct { 00056 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00057 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00058 int32_t opmode; /**< 00059 Current opmode. 00060 */ 00061 uint32_t num_identities; /**< 00062 The number of identities in the database. 00063 */ 00064 uint32_t recognized_identity; /**< 00065 The index of the recognized identity. 00066 */ 00067 char recognized_name[64]; /**< 00068 The name of the recognized identity. 00069 */ 00070 uint32_t num_detections; /**< 00071 Number of currently detected faces. 00072 */ 00073 uint32_t num_recognitions; /**< 00074 Number of recognized faces. 00075 */ 00076 uint32_t most_likely_identity; /**< 00077 The identity that was recognized most prevalently. 00078 */ 00079 float history_ratio; /**< 00080 The ratio of the most likely identity showing up in the history 00081 and the length of the history. 00082 */ 00083 float sec_since_detection; /**< 00084 Time in seconds since the last successful detection. 00085 */ 00086 int32_t visibility_history; /**< 00087 The number of consecutive sighting ( <= 1 ) and non-sightings 00088 ( >= -1 ), respectively. 00089 */ 00090 bool learning_in_progress; /**< 00091 Indicates whether a new identity is currently learnt. If 00092 learning is in progress only "old" faces can be recognized. 00093 */ 00094 float recording_progress; /**< 00095 Indicates the progress of recording images of a new face. 00096 */ 00097 float bearing; /**< 00098 The relative bearing to the recognized face in radians. 00099 */ 00100 float slope; /**< 00101 The relative slope to the recognized face in radians. 00102 */ 00103 uint32_t requested_index; /**< 00104 Index of the identity for which the name was requested. 00105 */ 00106 char requested_name[64]; /**< 00107 Requested name. 00108 */ 00109 } FacerInterface_data_t; 00110 #pragma pack(pop) 00111 00112 FacerInterface_data_t *data; 00113 00114 public: 00115 /* messages */ 00116 class LearnFaceMessage : public Message 00117 { 00118 private: 00119 #pragma pack(push,4) 00120 /** Internal data storage, do NOT modify! */ 00121 typedef struct { 00122 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00123 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00124 char name[64]; /**< The name assigned to the new identity. */ 00125 } LearnFaceMessage_data_t; 00126 #pragma pack(pop) 00127 00128 LearnFaceMessage_data_t *data; 00129 00130 public: 00131 LearnFaceMessage(const char * ini_name); 00132 LearnFaceMessage(); 00133 ~LearnFaceMessage(); 00134 00135 LearnFaceMessage(const LearnFaceMessage *m); 00136 /* Methods */ 00137 char * name() const; 00138 void set_name(const char * new_name); 00139 size_t maxlenof_name() const; 00140 virtual Message * clone() const; 00141 }; 00142 00143 class SetOpmodeMessage : public Message 00144 { 00145 private: 00146 #pragma pack(push,4) 00147 /** Internal data storage, do NOT modify! */ 00148 typedef struct { 00149 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00150 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00151 int32_t opmode; /**< 00152 Current opmode. 00153 */ 00154 } SetOpmodeMessage_data_t; 00155 #pragma pack(pop) 00156 00157 SetOpmodeMessage_data_t *data; 00158 00159 public: 00160 SetOpmodeMessage(const if_facer_opmode_t ini_opmode); 00161 SetOpmodeMessage(); 00162 ~SetOpmodeMessage(); 00163 00164 SetOpmodeMessage(const SetOpmodeMessage *m); 00165 /* Methods */ 00166 if_facer_opmode_t opmode() const; 00167 void set_opmode(const if_facer_opmode_t new_opmode); 00168 size_t maxlenof_opmode() const; 00169 virtual Message * clone() const; 00170 }; 00171 00172 class EnableIdentityMessage : public Message 00173 { 00174 private: 00175 #pragma pack(push,4) 00176 /** Internal data storage, do NOT modify! */ 00177 typedef struct { 00178 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00179 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00180 uint32_t index; /**< Index of the identity. */ 00181 bool enable; /**< En-/disable flag. */ 00182 } EnableIdentityMessage_data_t; 00183 #pragma pack(pop) 00184 00185 EnableIdentityMessage_data_t *data; 00186 00187 public: 00188 EnableIdentityMessage(const uint32_t ini_index, const bool ini_enable); 00189 EnableIdentityMessage(); 00190 ~EnableIdentityMessage(); 00191 00192 EnableIdentityMessage(const EnableIdentityMessage *m); 00193 /* Methods */ 00194 uint32_t index() const; 00195 void set_index(const uint32_t new_index); 00196 size_t maxlenof_index() const; 00197 bool is_enable() const; 00198 void set_enable(const bool new_enable); 00199 size_t maxlenof_enable() const; 00200 virtual Message * clone() const; 00201 }; 00202 00203 class SetNameMessage : public Message 00204 { 00205 private: 00206 #pragma pack(push,4) 00207 /** Internal data storage, do NOT modify! */ 00208 typedef struct { 00209 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00210 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00211 uint32_t index; /**< Index of the identity. */ 00212 char name[64]; /**< Name of the identity. */ 00213 } SetNameMessage_data_t; 00214 #pragma pack(pop) 00215 00216 SetNameMessage_data_t *data; 00217 00218 public: 00219 SetNameMessage(const uint32_t ini_index, const char * ini_name); 00220 SetNameMessage(); 00221 ~SetNameMessage(); 00222 00223 SetNameMessage(const SetNameMessage *m); 00224 /* Methods */ 00225 uint32_t index() const; 00226 void set_index(const uint32_t new_index); 00227 size_t maxlenof_index() const; 00228 char * name() const; 00229 void set_name(const char * new_name); 00230 size_t maxlenof_name() const; 00231 virtual Message * clone() const; 00232 }; 00233 00234 class GetNameMessage : public Message 00235 { 00236 private: 00237 #pragma pack(push,4) 00238 /** Internal data storage, do NOT modify! */ 00239 typedef struct { 00240 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00241 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00242 uint32_t index; /**< Index of the identity. */ 00243 } GetNameMessage_data_t; 00244 #pragma pack(pop) 00245 00246 GetNameMessage_data_t *data; 00247 00248 public: 00249 GetNameMessage(const uint32_t ini_index); 00250 GetNameMessage(); 00251 ~GetNameMessage(); 00252 00253 GetNameMessage(const GetNameMessage *m); 00254 /* Methods */ 00255 uint32_t index() const; 00256 void set_index(const uint32_t new_index); 00257 size_t maxlenof_index() const; 00258 virtual Message * clone() const; 00259 }; 00260 00261 virtual bool message_valid(const Message *message) const; 00262 private: 00263 FacerInterface(); 00264 ~FacerInterface(); 00265 00266 public: 00267 /* Methods */ 00268 if_facer_opmode_t opmode() const; 00269 void set_opmode(const if_facer_opmode_t new_opmode); 00270 size_t maxlenof_opmode() const; 00271 uint32_t num_identities() const; 00272 void set_num_identities(const uint32_t new_num_identities); 00273 size_t maxlenof_num_identities() const; 00274 uint32_t recognized_identity() const; 00275 void set_recognized_identity(const uint32_t new_recognized_identity); 00276 size_t maxlenof_recognized_identity() const; 00277 char * recognized_name() const; 00278 void set_recognized_name(const char * new_recognized_name); 00279 size_t maxlenof_recognized_name() const; 00280 uint32_t num_detections() const; 00281 void set_num_detections(const uint32_t new_num_detections); 00282 size_t maxlenof_num_detections() const; 00283 uint32_t num_recognitions() const; 00284 void set_num_recognitions(const uint32_t new_num_recognitions); 00285 size_t maxlenof_num_recognitions() const; 00286 uint32_t most_likely_identity() const; 00287 void set_most_likely_identity(const uint32_t new_most_likely_identity); 00288 size_t maxlenof_most_likely_identity() const; 00289 float history_ratio() const; 00290 void set_history_ratio(const float new_history_ratio); 00291 size_t maxlenof_history_ratio() const; 00292 float sec_since_detection() const; 00293 void set_sec_since_detection(const float new_sec_since_detection); 00294 size_t maxlenof_sec_since_detection() const; 00295 int32_t visibility_history() const; 00296 void set_visibility_history(const int32_t new_visibility_history); 00297 size_t maxlenof_visibility_history() const; 00298 bool is_learning_in_progress() const; 00299 void set_learning_in_progress(const bool new_learning_in_progress); 00300 size_t maxlenof_learning_in_progress() const; 00301 float recording_progress() const; 00302 void set_recording_progress(const float new_recording_progress); 00303 size_t maxlenof_recording_progress() const; 00304 float bearing() const; 00305 void set_bearing(const float new_bearing); 00306 size_t maxlenof_bearing() const; 00307 float slope() const; 00308 void set_slope(const float new_slope); 00309 size_t maxlenof_slope() const; 00310 uint32_t requested_index() const; 00311 void set_requested_index(const uint32_t new_requested_index); 00312 size_t maxlenof_requested_index() const; 00313 char * requested_name() const; 00314 void set_requested_name(const char * new_requested_name); 00315 size_t maxlenof_requested_name() const; 00316 virtual Message * create_message(const char *type) const; 00317 00318 virtual void copy_values(const Interface *other); 00319 virtual const char * enum_tostring(const char *enumtype, int val) const; 00320 00321 }; 00322 00323 } // end namespace fawkes 00324 00325 #endif