Commit 9d38540f31a2f52b78de9f706c5e4a505d64521e
1 parent
25b253ca
added templateGallery
Showing
1 changed file
with
26 additions
and
0 deletions
openbr/plugins/gallery.cpp
| @@ -605,6 +605,32 @@ BR_REGISTER(Gallery, xmlGallery) | @@ -605,6 +605,32 @@ BR_REGISTER(Gallery, xmlGallery) | ||
| 605 | 605 | ||
| 606 | /*! | 606 | /*! |
| 607 | * \ingroup galleries | 607 | * \ingroup galleries |
| 608 | + * \brief Treat the file as a single binary template. | ||
| 609 | + * \author Josh Klontz \cite jklontz | ||
| 610 | + */ | ||
| 611 | +class templateGallery : public Gallery | ||
| 612 | +{ | ||
| 613 | + Q_OBJECT | ||
| 614 | + | ||
| 615 | + TemplateList readBlock(bool *done) | ||
| 616 | + { | ||
| 617 | + *done = true; | ||
| 618 | + QByteArray data; | ||
| 619 | + QtUtils::readFile(file.name.left(file.name.size()-QString(".template").size()), data); | ||
| 620 | + return TemplateList() << Template(file, cv::Mat(1, data.size(), CV_8UC1, data.data()).clone()); | ||
| 621 | + } | ||
| 622 | + | ||
| 623 | + void write(const Template &t) | ||
| 624 | + { | ||
| 625 | + (void) t; | ||
| 626 | + qFatal("No supported."); | ||
| 627 | + } | ||
| 628 | +}; | ||
| 629 | + | ||
| 630 | +BR_REGISTER(Gallery, templateGallery) | ||
| 631 | + | ||
| 632 | +/*! | ||
| 633 | + * \ingroup galleries | ||
| 608 | * \brief Database input. | 634 | * \brief Database input. |
| 609 | * \author Josh Klontz \cite jklontz | 635 | * \author Josh Klontz \cite jklontz |
| 610 | */ | 636 | */ |