13 #ifndef __PBIO_API__PBIO__EMOTIONS_ESTIMATOR_H_
14 #define __PBIO_API__PBIO__EMOTIONS_ESTIMATOR_H_
20 #include "ComplexObject.h"
21 #include "RawSample.h"
24 #include "stl_wraps_impls/WrapOStreamImpl.h"
50 typedef LightSmartPtr<EmotionsEstimator>::tPtr
Ptr;
174 const DHPtr &dll_handle,
194 EmotionsEstimator::EmotionsEstimator(
195 const DHPtr &dll_handle,
197 ComplexObject(dll_handle, impl)
207 void* exception = NULL;
209 std::ostringstream data_oss;
211 stl_wraps::WrapOStreamImpl data_oss_w(data_oss);
213 const int count = _dll_handle->EmotionsEstimator_estimateEmotions(
215 (pbio::facerec::RawSampleImpl
const*) sample._impl,
217 pbio::stl_wraps::WrapOStreamImpl::write_func,
220 checkException(exception, *_dll_handle);
222 std::istringstream data_iss(data_oss.str());
224 std::vector<EmotionConfidence> result(count);
226 for(
int i = 0; i < count; ++i)
231 data_iss.read((
char*)&emotion,
sizeof(emotion));
232 data_iss.read((
char*)&confidence,
sizeof(confidence));
234 result[i].emotion = (
Emotion) emotion;
235 result[i].confidence = confidence;
245 #endif // __PBIO_API__PBIO__EMOTIONS_ESTIMATOR_H_
Surprised.
Definition: EmotionsEstimator.h:85
Interface object for creating other interface objects.
Definition: FacerecService.h:64
Interface object that stores a captured face sample.
Definition: RawSample.h:49
LightSmartPtr< EmotionsEstimator >::tPtr Ptr
Alias for the type of a smart pointer to EmotionsEstimator.
Definition: EmotionsEstimator.h:50
Neutral.
Definition: EmotionsEstimator.h:64
std::vector< EmotionConfidence > EstimatedEmotionsVector
Vector of estimated emotions with confidence coefficients. In descending confidence order...
Definition: EmotionsEstimator.h:142
Sad.
Definition: EmotionsEstimator.h:106
Error - the class of exceptions thrown when errors occur.
Emotion with confidence.
Definition: EmotionsEstimator.h:114
float confidence
Positive real number in the range of [0; 1].
Definition: EmotionsEstimator.h:128
Emotion emotion
Emotion.
Definition: EmotionsEstimator.h:121
Happy.
Definition: EmotionsEstimator.h:71
Emotion
Emotions.
Definition: EmotionsEstimator.h:57
Scared.
Definition: EmotionsEstimator.h:99
EstimatedEmotionsVector estimateEmotions(const pbio::RawSample &sample) const
Estimates the emotion of a given face sample.
Definition: EmotionsEstimator.h:204
Definition: FacerecService.mm:79
Angry.
Definition: EmotionsEstimator.h:78
Disgusted.
Definition: EmotionsEstimator.h:92
Interface object for estimation of emotions.
Definition: EmotionsEstimator.h:41