Commit 04e5eb47b92daad796fc1b05a0f515308449560b
Merge pull request #282 from biometrics/janusComponent
Load Component Algorithm
Showing
1 changed file
with
7 additions
and
1 deletions
openbr/janus.cpp
| @@ -24,7 +24,10 @@ janus_error janus_initialize(const char *sdk_path, const char *temp_path, const | @@ -24,7 +24,10 @@ janus_error janus_initialize(const char *sdk_path, const char *temp_path, const | ||
| 24 | if (algorithm.isEmpty()) { | 24 | if (algorithm.isEmpty()) { |
| 25 | transform.reset(Transform::make("Cvt(Gray)+Affine(88,88,0.25,0.35)+<FaceRecognitionExtraction>+<FaceRecognitionEmbedding>+<FaceRecognitionQuantization>", NULL)); | 25 | transform.reset(Transform::make("Cvt(Gray)+Affine(88,88,0.25,0.35)+<FaceRecognitionExtraction>+<FaceRecognitionEmbedding>+<FaceRecognitionQuantization>", NULL)); |
| 26 | distance = Distance::fromAlgorithm("FaceRecognition"); | 26 | distance = Distance::fromAlgorithm("FaceRecognition"); |
| 27 | - } else { | 27 | + } else if (algorithm.compare("Component") == 0) { |
| 28 | + transform.reset(Transform::make("StasmManual+Cvt(Gray)+<ComponentEnroll>", NULL)); | ||
| 29 | + distance = Distance::fromAlgorithm(algorithm); | ||
| 30 | + } else { | ||
| 28 | transform.reset(Transform::make(algorithm + "Enroll", NULL)); | 31 | transform.reset(Transform::make(algorithm + "Enroll", NULL)); |
| 29 | distance.reset(Distance::make(algorithm + "Compare", NULL)); | 32 | distance.reset(Distance::make(algorithm + "Compare", NULL)); |
| 30 | } | 33 | } |
| @@ -83,11 +86,14 @@ janus_error janus_augment(const janus_image image, const janus_attribute_list at | @@ -83,11 +86,14 @@ janus_error janus_augment(const janus_image image, const janus_attribute_list at | ||
| 83 | t.file.contains("LEFT_EYE_Y")) { | 86 | t.file.contains("LEFT_EYE_Y")) { |
| 84 | t.file.set("Affine_0", QPointF(t.file.get<float>("RIGHT_EYE_X") - rect.x(), t.file.get<float>("RIGHT_EYE_Y") - rect.y())); | 87 | t.file.set("Affine_0", QPointF(t.file.get<float>("RIGHT_EYE_X") - rect.x(), t.file.get<float>("RIGHT_EYE_Y") - rect.y())); |
| 85 | t.file.set("Affine_1", QPointF(t.file.get<float>("LEFT_EYE_X") - rect.x(), t.file.get<float>("LEFT_EYE_Y") - rect.y())); | 88 | t.file.set("Affine_1", QPointF(t.file.get<float>("LEFT_EYE_X") - rect.x(), t.file.get<float>("LEFT_EYE_Y") - rect.y())); |
| 89 | + t.file.set("First_Eye", t.file.get<QPointF>("Affine_0")); | ||
| 90 | + t.file.set("Second_Eye", t.file.get<QPointF>("Affine_1")); | ||
| 86 | t.file.appendPoint(t.file.get<QPointF>("Affine_0")); | 91 | t.file.appendPoint(t.file.get<QPointF>("Affine_0")); |
| 87 | t.file.appendPoint(t.file.get<QPointF>("Affine_1")); | 92 | t.file.appendPoint(t.file.get<QPointF>("Affine_1")); |
| 88 | } | 93 | } |
| 89 | Template u; | 94 | Template u; |
| 90 | transform->project(t, u); | 95 | transform->project(t, u); |
| 96 | + if (u.file.fte) u.m() = cv::Mat(); | ||
| 91 | template_->append(u); | 97 | template_->append(u); |
| 92 | return (u.isEmpty() || !u.first().data) ? JANUS_FAILURE_TO_ENROLL : JANUS_SUCCESS; | 98 | return (u.isEmpty() || !u.first().data) ? JANUS_FAILURE_TO_ENROLL : JANUS_SUCCESS; |
| 93 | } | 99 | } |