Commit a30beafbf64e56e46f832a52c262db04d1be4fbc
1 parent
d32ba202
updated to latest janus
Showing
3 changed files
with
7 additions
and
7 deletions
openbr/janus.cpp
| @@ -60,14 +60,14 @@ janus_error janus_augment(const janus_image image, const janus_attribute_list at | @@ -60,14 +60,14 @@ janus_error janus_augment(const janus_image image, const janus_attribute_list at | ||
| 60 | !t.file.contains("RIGHT_EYE_Y") || | 60 | !t.file.contains("RIGHT_EYE_Y") || |
| 61 | !t.file.contains("LEFT_EYE_X") || | 61 | !t.file.contains("LEFT_EYE_X") || |
| 62 | !t.file.contains("LEFT_EYE_Y")) | 62 | !t.file.contains("LEFT_EYE_Y")) |
| 63 | - return JANUS_SUCCESS; | 63 | + return JANUS_MISSING_ATTRIBUTES; |
| 64 | 64 | ||
| 65 | t.file.set("Affine_0", QPointF(t.file.get<float>("RIGHT_EYE_X"), t.file.get<float>("RIGHT_EYE_Y"))); | 65 | t.file.set("Affine_0", QPointF(t.file.get<float>("RIGHT_EYE_X"), t.file.get<float>("RIGHT_EYE_Y"))); |
| 66 | t.file.set("Affine_1", QPointF(t.file.get<float>("LEFT_EYE_X"), t.file.get<float>("LEFT_EYE_Y"))); | 66 | t.file.set("Affine_1", QPointF(t.file.get<float>("LEFT_EYE_X"), t.file.get<float>("LEFT_EYE_Y"))); |
| 67 | Template u; | 67 | Template u; |
| 68 | transform->project(t, u); | 68 | transform->project(t, u); |
| 69 | template_->append(u); | 69 | template_->append(u); |
| 70 | - return JANUS_SUCCESS; | 70 | + return u.isEmpty() ? JANUS_FAILURE_TO_ENROLL : JANUS_SUCCESS; |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | janus_error janus_finalize_template(janus_template template_, janus_flat_template flat_template, size_t *bytes) | 73 | janus_error janus_finalize_template(janus_template template_, janus_flat_template flat_template, size_t *bytes) |
openbr/janus_io.cpp
| @@ -11,11 +11,11 @@ static void _janus_add_sample(vector<double> &samples, double sample) | @@ -11,11 +11,11 @@ static void _janus_add_sample(vector<double> &samples, double sample) | ||
| 11 | samples.push_back(sample); | 11 | samples.push_back(sample); |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | -static void _janus_create_template(const char *data_path, TemplateData templateData, janus_gallery gallery) | 14 | +static void _janus_create_template(const char *data_path, TemplateData templateData, janus_gallery gallery, bool verbose) |
| 15 | { | 15 | { |
| 16 | janus_template template_; | 16 | janus_template template_; |
| 17 | janus_template_id templateID; | 17 | janus_template_id templateID; |
| 18 | - JANUS_ASSERT(TemplateIterator::create(data_path, templateData, &template_, &templateID)) | 18 | + JANUS_ASSERT(TemplateIterator::create(data_path, templateData, &template_, &templateID, verbose)) |
| 19 | 19 | ||
| 20 | static QMutex enrollLock; | 20 | static QMutex enrollLock; |
| 21 | QMutexLocker enrollLocker(&enrollLock); | 21 | QMutexLocker enrollLocker(&enrollLock); |
| @@ -23,13 +23,13 @@ static void _janus_create_template(const char *data_path, TemplateData templateD | @@ -23,13 +23,13 @@ static void _janus_create_template(const char *data_path, TemplateData templateD | ||
| 23 | JANUS_ASSERT(janus_enroll(template_, templateID, gallery)) | 23 | JANUS_ASSERT(janus_enroll(template_, templateID, gallery)) |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | -janus_error janus_create_gallery(const char *data_path, janus_metadata metadata, janus_gallery gallery) | 26 | +janus_error janus_create_gallery(const char *data_path, janus_metadata metadata, janus_gallery gallery, bool verbose) |
| 27 | { | 27 | { |
| 28 | TemplateIterator ti(metadata, true); | 28 | TemplateIterator ti(metadata, true); |
| 29 | TemplateData templateData = ti.next(); | 29 | TemplateData templateData = ti.next(); |
| 30 | QFutureSynchronizer<void> futures; | 30 | QFutureSynchronizer<void> futures; |
| 31 | while (!templateData.templateIDs.empty()) { | 31 | while (!templateData.templateIDs.empty()) { |
| 32 | - futures.addFuture(QtConcurrent::run(_janus_create_template, data_path, templateData, gallery)); | 32 | + futures.addFuture(QtConcurrent::run(_janus_create_template, data_path, templateData, gallery, verbose)); |
| 33 | templateData = ti.next(); | 33 | templateData = ti.next(); |
| 34 | } | 34 | } |
| 35 | futures.waitForFinished(); | 35 | futures.waitForFinished(); |