Commit 20cdcd94d7295090f444d94561a626c64d55c11a
1 parent
bcd1eb16
PP5 building, bypassing _compare for now
Showing
1 changed file
with
23 additions
and
12 deletions
sdk/plugins/pp5.cpp
| @@ -11,9 +11,9 @@ | @@ -11,9 +11,9 @@ | ||
| 11 | #include <pittpatt_raw_image_io.h> | 11 | #include <pittpatt_raw_image_io.h> |
| 12 | #include <pittpatt_sdk.h> | 12 | #include <pittpatt_sdk.h> |
| 13 | #include <pittpatt_license.h> | 13 | #include <pittpatt_license.h> |
| 14 | -#include <mm_plugin.h> | 14 | +#include <openbr_plugin.h> |
| 15 | 15 | ||
| 16 | -#include "common/resource.h" | 16 | +#include "core/resource.h" |
| 17 | 17 | ||
| 18 | #define TRY(CC) \ | 18 | #define TRY(CC) \ |
| 19 | { \ | 19 | { \ |
| @@ -30,7 +30,7 @@ | @@ -30,7 +30,7 @@ | ||
| 30 | if ((CC) != PPR_RAW_IMAGE_SUCCESS) qFatal("%d error (%s, %d): %s.", CC, __FILE__, __LINE__, ppr_raw_image_error_message(CC)); \ | 30 | if ((CC) != PPR_RAW_IMAGE_SUCCESS) qFatal("%d error (%s, %d): %s.", CC, __FILE__, __LINE__, ppr_raw_image_error_message(CC)); \ |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | -using namespace mm; | 33 | +using namespace br; |
| 34 | 34 | ||
| 35 | class PP5Initializer : public Initializer | 35 | class PP5Initializer : public Initializer |
| 36 | { | 36 | { |
| @@ -38,8 +38,8 @@ class PP5Initializer : public Initializer | @@ -38,8 +38,8 @@ class PP5Initializer : public Initializer | ||
| 38 | 38 | ||
| 39 | void initialize() const | 39 | void initialize() const |
| 40 | { | 40 | { |
| 41 | - TRY(ppr_initialize_sdk(qPrintable(Globals->SDKPath + "/models/pp5/"), my_license_id, my_license_key)) | ||
| 42 | - Globals->Abbreviations.insert("PP5","Open+PP5Enroll!Identity:PP5Compare"); | 41 | + TRY(ppr_initialize_sdk(qPrintable(Globals->sdkPath + "/models/pp5/"), my_license_id, my_license_key)) |
| 42 | + Globals->abbreviations.insert("PP5","Open+PP5Enroll!Identity:PP5Compare"); | ||
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | void finalize() const | 45 | void finalize() const |
| @@ -48,7 +48,7 @@ class PP5Initializer : public Initializer | @@ -48,7 +48,7 @@ class PP5Initializer : public Initializer | ||
| 48 | } | 48 | } |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | -MM_REGISTER(Initializer, PP5Initializer, "") | 51 | +BR_REGISTER(Initializer, PP5Initializer) |
| 52 | 52 | ||
| 53 | struct PP5Context | 53 | struct PP5Context |
| 54 | { | 54 | { |
| @@ -194,11 +194,11 @@ struct PP5Context | @@ -194,11 +194,11 @@ struct PP5Context | ||
| 194 | } | 194 | } |
| 195 | }; | 195 | }; |
| 196 | 196 | ||
| 197 | -class PP5Enroll : public UntrainableFeature | 197 | +class PP5Enroll : public UntrainableTransform |
| 198 | { | 198 | { |
| 199 | Q_OBJECT | 199 | Q_OBJECT |
| 200 | Q_PROPERTY(bool detectOnly READ get_detectOnly WRITE set_detectOnly) | 200 | Q_PROPERTY(bool detectOnly READ get_detectOnly WRITE set_detectOnly) |
| 201 | - MM_MEMBER(bool, detectOnly) | 201 | + BR_PROPERTY(bool, detectOnly, false) |
| 202 | Resource<PP5Context> contexts; | 202 | Resource<PP5Context> contexts; |
| 203 | 203 | ||
| 204 | void project(const Template &src, Template &dst) const | 204 | void project(const Template &src, Template &dst) const |
| @@ -245,13 +245,22 @@ class PP5Enroll : public UntrainableFeature | @@ -245,13 +245,22 @@ class PP5Enroll : public UntrainableFeature | ||
| 245 | } | 245 | } |
| 246 | }; | 246 | }; |
| 247 | 247 | ||
| 248 | -MM_REGISTER(Feature, PP5Enroll, "bool detectOnly = 0") | 248 | +BR_REGISTER(Transform, PP5Enroll) |
| 249 | 249 | ||
| 250 | -class PP5Compare : public Comparer | 250 | + |
| 251 | + | ||
| 252 | +class PP5Compare : public Distance | ||
| 251 | , public PP5Context | 253 | , public PP5Context |
| 252 | { | 254 | { |
| 253 | Q_OBJECT | 255 | Q_OBJECT |
| 254 | 256 | ||
| 257 | + | ||
| 258 | + float _compare(const Template &target, const Template &query) const | ||
| 259 | + { | ||
| 260 | + qDebug("PP5Compare: _compare should never be called"); | ||
| 261 | + return 0; | ||
| 262 | + } | ||
| 263 | + | ||
| 255 | void compare(const TemplateList &target, const TemplateList &query, Output *output) const | 264 | void compare(const TemplateList &target, const TemplateList &query, Output *output) const |
| 256 | { | 265 | { |
| 257 | const float DefaultNonMatchScore = -1.5; | 266 | const float DefaultNonMatchScore = -1.5; |
| @@ -274,7 +283,7 @@ class PP5Compare : public Comparer | @@ -274,7 +283,7 @@ class PP5Compare : public Comparer | ||
| 274 | if ((query_face_id != -1) && (target_face_id != -1)) { | 283 | if ((query_face_id != -1) && (target_face_id != -1)) { |
| 275 | TRY(ppr_get_face_similarity_score(context, similarity_matrix, query_face_id, target_face_id, &score)) | 284 | TRY(ppr_get_face_similarity_score(context, similarity_matrix, query_face_id, target_face_id, &score)) |
| 276 | } | 285 | } |
| 277 | - output->setData(score, i, j); | 286 | + output->setRelative(score, i, j); |
| 278 | } | 287 | } |
| 279 | } | 288 | } |
| 280 | 289 | ||
| @@ -301,6 +310,8 @@ class PP5Compare : public Comparer | @@ -301,6 +310,8 @@ class PP5Compare : public Comparer | ||
| 301 | } | 310 | } |
| 302 | }; | 311 | }; |
| 303 | 312 | ||
| 304 | -MM_REGISTER(Comparer, PP5Compare, "") | 313 | +BR_REGISTER(Distance, PP5Compare) |
| 314 | + | ||
| 315 | + | ||
| 305 | 316 | ||
| 306 | #include "plugins/pp5.moc" | 317 | #include "plugins/pp5.moc" |