Commit e454db0ac919a12e21b75ac3afddfc67f17fdfe1
1 parent
32b421d5
Modifications to GalleryCompareTransform
Take an algorithm description as input for the distance, ideally we would support inputting an algorithm or just a distance string, but currently that seems infeasible (no recovery if we fail to create something).
Showing
1 changed file
with
10 additions
and
3 deletions
openbr/plugins/distance.cpp
| @@ -460,12 +460,13 @@ BR_REGISTER(Distance, SumDistance) | @@ -460,12 +460,13 @@ BR_REGISTER(Distance, SumDistance) | ||
| 460 | class GalleryCompareTransform : public Transform | 460 | class GalleryCompareTransform : public Transform |
| 461 | { | 461 | { |
| 462 | Q_OBJECT | 462 | Q_OBJECT |
| 463 | - Q_PROPERTY(br::Distance *distance READ get_distance WRITE set_distance RESET reset_distance STORED false) | 463 | + Q_PROPERTY(QString distanceAlgorithm READ get_distanceAlgorithm WRITE set_distanceAlgorithm RESET reset_distanceAlgorithm STORED false) |
| 464 | Q_PROPERTY(QString galleryName READ get_galleryName WRITE set_galleryName RESET reset_galleryName STORED false) | 464 | Q_PROPERTY(QString galleryName READ get_galleryName WRITE set_galleryName RESET reset_galleryName STORED false) |
| 465 | - BR_PROPERTY(br::Distance*, distance, NULL) | 465 | + BR_PROPERTY(QString, distanceAlgorithm, "") |
| 466 | BR_PROPERTY(QString, galleryName, "") | 466 | BR_PROPERTY(QString, galleryName, "") |
| 467 | 467 | ||
| 468 | TemplateList gallery; | 468 | TemplateList gallery; |
| 469 | + QSharedPointer<Distance> distance; | ||
| 469 | 470 | ||
| 470 | void project(const Template &src, Template &dst) const | 471 | void project(const Template &src, Template &dst) const |
| 471 | { | 472 | { |
| @@ -479,8 +480,14 @@ class GalleryCompareTransform : public Transform | @@ -479,8 +480,14 @@ class GalleryCompareTransform : public Transform | ||
| 479 | 480 | ||
| 480 | void init() | 481 | void init() |
| 481 | { | 482 | { |
| 482 | - if (!galleryName.isEmpty()) | 483 | + if (!galleryName.isEmpty()) { |
| 483 | gallery = TemplateList::fromGallery(galleryName); | 484 | gallery = TemplateList::fromGallery(galleryName); |
| 485 | + qDebug() << "Gal compare reading templates from " << galleryName; | ||
| 486 | + } | ||
| 487 | + if (!distanceAlgorithm.isEmpty()) | ||
| 488 | + { | ||
| 489 | + distance = Distance::fromAlgorithm(distanceAlgorithm); | ||
| 490 | + } | ||
| 484 | } | 491 | } |
| 485 | }; | 492 | }; |
| 486 | 493 |