24 #include <interfaces/FacerInterface.h> 26 #include <core/exceptions/software.h> 50 FacerInterface::FacerInterface() : Interface()
52 data_size =
sizeof(FacerInterface_data_t);
54 data = (FacerInterface_data_t *)
data_ptr;
57 enum_map_if_facer_opmode_t[(int)OPMODE_DISABLED] =
"OPMODE_DISABLED";
58 enum_map_if_facer_opmode_t[(int)OPMODE_DETECTION] =
"OPMODE_DETECTION";
59 enum_map_if_facer_opmode_t[(int)OPMODE_RECOGNITION] =
"OPMODE_RECOGNITION";
60 enum_map_if_facer_opmode_t[(int)OPMODE_LEARNING] =
"OPMODE_LEARNING";
61 enum_map_if_facer_opmode_t[(int)OPMODE_GENDER] =
"OPMODE_GENDER";
62 add_fieldinfo(
IFT_ENUM,
"opmode", 1, &data->opmode,
"if_facer_opmode_t", &enum_map_if_facer_opmode_t);
88 unsigned char tmp_hash[] = {0x5d, 0xd, 0xac, 0xa1, 0xe1, 0x23, 0x82, 0xc4, 0x22, 0xed, 0x8b, 0xa7, 0x3e, 0x1f, 0x2d, 0x7c};
93 FacerInterface::~FacerInterface()
105 case OPMODE_DISABLED:
return "OPMODE_DISABLED";
106 case OPMODE_DETECTION:
return "OPMODE_DETECTION";
107 case OPMODE_RECOGNITION:
return "OPMODE_RECOGNITION";
108 case OPMODE_LEARNING:
return "OPMODE_LEARNING";
109 case OPMODE_GENDER:
return "OPMODE_GENDER";
110 default:
return "UNKNOWN";
145 data->opmode = new_opmode;
158 return data->num_identities;
180 data->num_identities = new_num_identities;
193 return data->recognized_identity;
215 data->recognized_identity = new_recognized_identity;
228 return data->recognized_name;
250 strncpy(data->recognized_name, new_recognized_name,
sizeof(data->recognized_name));
263 return data->num_detections;
285 data->num_detections = new_num_detections;
298 return data->num_recognitions;
320 data->num_recognitions = new_num_recognitions;
333 return data->most_likely_identity;
355 data->most_likely_identity = new_most_likely_identity;
368 return data->most_likely_gender;
390 strncpy(data->most_likely_gender, new_most_likely_gender,
sizeof(data->most_likely_gender));
404 return data->history_ratio;
427 data->history_ratio = new_history_ratio;
440 return data->sec_since_detection;
462 data->sec_since_detection = new_sec_since_detection;
476 return data->visibility_history;
499 data->visibility_history = new_visibility_history;
513 return data->learning_in_progress;
536 data->learning_in_progress = new_learning_in_progress;
551 return data->searching_person;
575 data->searching_person = new_searching_person;
588 return data->recording_progress;
610 data->recording_progress = new_recording_progress;
623 return data->bearing;
645 data->bearing = new_bearing;
680 data->slope = new_slope;
693 return data->requested_index;
715 data->requested_index = new_requested_index;
728 return data->requested_name;
750 strncpy(data->requested_name, new_requested_name,
sizeof(data->requested_name));
763 return data->index_last_learned;
785 data->index_last_learned = new_index_last_learned;
793 if ( strncmp(
"LearnFaceMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
795 }
else if ( strncmp(
"SetOpmodeMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
797 }
else if ( strncmp(
"EnableIdentityMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
799 }
else if ( strncmp(
"SetNameMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
801 }
else if ( strncmp(
"GetNameMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
803 }
else if ( strncmp(
"StartSearchPersonMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
805 }
else if ( strncmp(
"StopSearchPersonMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
809 "message type for this interface type.", type);
825 memcpy(data, oi->data,
sizeof(FacerInterface_data_t));
831 if (strcmp(enumtype,
"if_facer_opmode_t") == 0) {
850 data_size =
sizeof(LearnFaceMessage_data_t);
853 data = (LearnFaceMessage_data_t *)
data_ptr;
855 strncpy(data->name, ini_name, 64);
860 enum_map_if_facer_opmode_t[(int)
OPMODE_GENDER] =
"OPMODE_GENDER";
866 data_size =
sizeof(LearnFaceMessage_data_t);
869 data = (LearnFaceMessage_data_t *)
data_ptr;
875 enum_map_if_facer_opmode_t[(int)
OPMODE_GENDER] =
"OPMODE_GENDER";
893 data = (LearnFaceMessage_data_t *)
data_ptr;
925 strncpy(data->name, new_name,
sizeof(data->name));
950 data_size =
sizeof(SetOpmodeMessage_data_t);
953 data = (SetOpmodeMessage_data_t *)
data_ptr;
955 data->opmode = ini_opmode;
960 enum_map_if_facer_opmode_t[(int)
OPMODE_GENDER] =
"OPMODE_GENDER";
961 add_fieldinfo(
IFT_ENUM,
"opmode", 1, &data->opmode,
"if_facer_opmode_t", &enum_map_if_facer_opmode_t);
966 data_size =
sizeof(SetOpmodeMessage_data_t);
969 data = (SetOpmodeMessage_data_t *)
data_ptr;
975 enum_map_if_facer_opmode_t[(int)
OPMODE_GENDER] =
"OPMODE_GENDER";
976 add_fieldinfo(
IFT_ENUM,
"opmode", 1, &data->opmode,
"if_facer_opmode_t", &enum_map_if_facer_opmode_t);
993 data = (SetOpmodeMessage_data_t *)
data_ptr;
1029 data->opmode = new_opmode;
1055 data_size =
sizeof(EnableIdentityMessage_data_t);
1058 data = (EnableIdentityMessage_data_t *)
data_ptr;
1060 data->index = ini_index;
1061 data->enable = ini_enable;
1066 enum_map_if_facer_opmode_t[(int)
OPMODE_GENDER] =
"OPMODE_GENDER";
1073 data_size =
sizeof(EnableIdentityMessage_data_t);
1076 data = (EnableIdentityMessage_data_t *)
data_ptr;
1082 enum_map_if_facer_opmode_t[(int)
OPMODE_GENDER] =
"OPMODE_GENDER";
1101 data = (EnableIdentityMessage_data_t *)
data_ptr;
1133 data->index = new_index;
1143 return data->enable;
1163 data->enable = new_enable;
1189 data_size =
sizeof(SetNameMessage_data_t);
1192 data = (SetNameMessage_data_t *)
data_ptr;
1194 data->index = ini_index;
1195 strncpy(data->name, ini_name, 64);
1200 enum_map_if_facer_opmode_t[(int)
OPMODE_GENDER] =
"OPMODE_GENDER";
1207 data_size =
sizeof(SetNameMessage_data_t);
1210 data = (SetNameMessage_data_t *)
data_ptr;
1216 enum_map_if_facer_opmode_t[(int)
OPMODE_GENDER] =
"OPMODE_GENDER";
1235 data = (SetNameMessage_data_t *)
data_ptr;
1267 data->index = new_index;
1297 strncpy(data->name, new_name,
sizeof(data->name));
1322 data_size =
sizeof(GetNameMessage_data_t);
1325 data = (GetNameMessage_data_t *)
data_ptr;
1327 data->index = ini_index;
1332 enum_map_if_facer_opmode_t[(int)
OPMODE_GENDER] =
"OPMODE_GENDER";
1338 data_size =
sizeof(GetNameMessage_data_t);
1341 data = (GetNameMessage_data_t *)
data_ptr;
1347 enum_map_if_facer_opmode_t[(int)
OPMODE_GENDER] =
"OPMODE_GENDER";
1365 data = (GetNameMessage_data_t *)
data_ptr;
1397 data->index = new_index;
1422 data_size =
sizeof(StartSearchPersonMessage_data_t);
1425 data = (StartSearchPersonMessage_data_t *)
data_ptr;
1427 data->index = ini_index;
1432 enum_map_if_facer_opmode_t[(int)
OPMODE_GENDER] =
"OPMODE_GENDER";
1438 data_size =
sizeof(StartSearchPersonMessage_data_t);
1441 data = (StartSearchPersonMessage_data_t *)
data_ptr;
1447 enum_map_if_facer_opmode_t[(int)
OPMODE_GENDER] =
"OPMODE_GENDER";
1465 data = (StartSearchPersonMessage_data_t *)
data_ptr;
1497 data->index = new_index;
1520 data_size =
sizeof(StopSearchPersonMessage_data_t);
1523 data = (StopSearchPersonMessage_data_t *)
data_ptr;
1529 enum_map_if_facer_opmode_t[(int)
OPMODE_GENDER] =
"OPMODE_GENDER";
1546 data = (StopSearchPersonMessage_data_t *)
data_ptr;
size_t maxlenof_index_last_learned() const
Get maximum length of index_last_learned value.
bool is_enable() const
Get enable value.
StopSearchPersonMessage Fawkes BlackBoard Interface Message.
char * recognized_name() const
Get recognized_name value.
Facer will detect faces and try to identify the gender of the faces.
void * data_ptr
Pointer to memory that contains local data.
if_facer_opmode_t opmode() const
Get opmode value.
uint32_t num_detections() const
Get num_detections value.
void set_index_last_learned(const uint32_t new_index_last_learned)
Set index_last_learned value.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
virtual Message * clone() const
Clone this message.
uint32_t index() const
Get index value.
void set_most_likely_identity(const uint32_t new_most_likely_identity)
Set most_likely_identity value.
size_t maxlenof_opmode() const
Get maximum length of opmode value.
size_t maxlenof_index() const
Get maximum length of index value.
char * name() const
Get name value.
void set_enable(const bool new_enable)
Set enable value.
SetOpmodeMessage Fawkes BlackBoard Interface Message.
uint32_t recognized_identity() const
Get recognized_identity value.
uint32_t index() const
Get index value.
void set_hash(unsigned char *ihash)
Set hash.
SetNameMessage Fawkes BlackBoard Interface Message.
float history_ratio() const
Get history_ratio value.
size_t maxlenof_history_ratio() const
Get maximum length of history_ratio value.
size_t maxlenof_most_likely_gender() const
Get maximum length of most_likely_gender value.
Fawkes library namespace.
size_t maxlenof_num_identities() const
Get maximum length of num_identities value.
size_t maxlenof_sec_since_detection() const
Get maximum length of sec_since_detection value.
Timestamp data, must be present and first entries for each interface data structs! This leans on time...
size_t maxlenof_bearing() const
Get maximum length of bearing value.
uint32_t most_likely_identity() const
Get most_likely_identity value.
size_t maxlenof_learning_in_progress() const
Get maximum length of learning_in_progress value.
size_t maxlenof_most_likely_identity() const
Get maximum length of most_likely_identity value.
const char * tostring_if_facer_opmode_t(if_facer_opmode_t value) const
Convert if_facer_opmode_t constant to string.
void set_index(const uint32_t new_index)
Set index value.
virtual void copy_values(const Interface *other)
Copy values from other interface.
Facer will detect faces, and then try to recognize the most dominant face.
~SetNameMessage()
Destructor.
SetNameMessage()
Constructor.
size_t maxlenof_recording_progress() const
Get maximum length of recording_progress value.
char * name() const
Get name value.
char * most_likely_gender() const
Get most_likely_gender value.
size_t maxlenof_searching_person() const
Get maximum length of searching_person value.
SetOpmodeMessage()
Constructor.
Base class for all Fawkes BlackBoard interfaces.
void set_num_identities(const uint32_t new_num_identities)
Set num_identities value.
~LearnFaceMessage()
Destructor.
GetNameMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_index() const
Get maximum length of index value.
size_t maxlenof_visibility_history() const
Get maximum length of visibility_history value.
void set_sec_since_detection(const float new_sec_since_detection)
Set sec_since_detection value.
uint32_t index() const
Get index value.
StopSearchPersonMessage()
Constructor.
virtual Message * clone() const
Clone this message.
if_facer_opmode_t opmode() const
Get opmode value.
void set_slope(const float new_slope)
Set slope value.
void set_recognized_identity(const uint32_t new_recognized_identity)
Set recognized_identity value.
size_t maxlenof_requested_index() const
Get maximum length of requested_index value.
size_t maxlenof_index() const
Get maximum length of index value.
void set_index(const uint32_t new_index)
Set index value.
EnableIdentityMessage()
Constructor.
message_data_ts_t * data_ts
data timestamp aliasing pointer
void set_visibility_history(const int32_t new_visibility_history)
Set visibility_history value.
size_t maxlenof_opmode() const
Get maximum length of opmode value.
unsigned int data_size
Size of memory needed to hold all data.
~EnableIdentityMessage()
Destructor.
Facer will detect faces, but not try to recognize them.
bool is_searching_person() const
Get searching_person value.
uint32_t index_last_learned() const
Get index_last_learned value.
uint32_t num_identities() const
Get num_identities value.
uint32_t requested_index() const
Get requested_index value.
void add_messageinfo(const char *name)
Add an entry to the message info list.
bool data_changed
Indicator if data has changed.
float sec_since_detection() const
Get sec_since_detection value.
const char * type() const
Get type of interface.
void set_searching_person(const bool new_searching_person)
Set searching_person value.
void set_name(const char *new_name)
Set name value.
size_t maxlenof_index() const
Get maximum length of index value.
size_t maxlenof_name() const
Get maximum length of name value.
size_t maxlenof_requested_name() const
Get maximum length of requested_name value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
StartSearchPersonMessage()
Constructor.
virtual Message * clone() const
Clone this message.
~StopSearchPersonMessage()
Destructor.
void set_opmode(const if_facer_opmode_t new_opmode)
Set opmode value.
virtual Message * clone() const
Clone this message.
float slope() const
Get slope value.
void set_num_detections(const uint32_t new_num_detections)
Set num_detections value.
virtual Message * create_message(const char *type) const
Create message based on type name.
StartSearchPersonMessage Fawkes BlackBoard Interface Message.
Facer will not process any images.
int32_t visibility_history() const
Get visibility_history value.
LearnFaceMessage Fawkes BlackBoard Interface Message.
virtual Message * clone() const
Clone this message.
size_t maxlenof_num_recognitions() const
Get maximum length of num_recognitions value.
void set_requested_name(const char *new_requested_name)
Set requested_name value.
size_t maxlenof_num_detections() const
Get maximum length of num_detections value.
void set_requested_index(const uint32_t new_requested_index)
Set requested_index value.
bool is_learning_in_progress() const
Get learning_in_progress value.
void set_opmode(const if_facer_opmode_t new_opmode)
Set opmode value.
size_t maxlenof_name() const
Get maximum length of name value.
void set_bearing(const float new_bearing)
Set bearing value.
size_t maxlenof_recognized_name() const
Get maximum length of recognized_name value.
Facer will gather images and learn an identity.
size_t maxlenof_recognized_identity() const
Get maximum length of recognized_identity value.
void set_num_recognitions(const uint32_t new_num_recognitions)
Set num_recognitions value.
FacerInterface Fawkes BlackBoard Interface.
void set_learning_in_progress(const bool new_learning_in_progress)
Set learning_in_progress value.
void set_recording_progress(const float new_recording_progress)
Set recording_progress value.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
~SetOpmodeMessage()
Destructor.
uint32_t num_recognitions() const
Get num_recognitions value.
GetNameMessage()
Constructor.
void set_most_likely_gender(const char *new_most_likely_gender)
Set most_likely_gender value.
void set_history_ratio(const float new_history_ratio)
Set history_ratio value.
LearnFaceMessage()
Constructor.
void add_fieldinfo(interface_fieldtype_t type, const char *name, size_t length, void *value, const char *enumtype=0, const interface_enum_map_t *enum_map=0)
Add an entry to the info list.
size_t maxlenof_slope() const
Get maximum length of slope value.
~GetNameMessage()
Destructor.
virtual Message * clone() const
Clone this message.
virtual Message * clone() const
Clone this message.
EnableIdentityMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_enable() const
Get maximum length of enable value.
void set_index(const uint32_t new_index)
Set index value.
char * requested_name() const
Get requested_name value.
const char * type() const
Get message type.
if_facer_opmode_t
This determines the current status of skill execution.
float recording_progress() const
Get recording_progress value.
32 bit unsigned integer field
field with interface specific enum type
float bearing() const
Get bearing value.
void set_index(const uint32_t new_index)
Set index value.
uint32_t index() const
Get index value.
void set_name(const char *new_name)
Set name value.
~StartSearchPersonMessage()
Destructor.
void set_recognized_name(const char *new_recognized_name)
Set recognized_name value.