Commit 5f65900959fe5ec25da9476f08f7c4b42d07b846
1 parent
2fc1d15e
Preliminary support for FBI EBTS format
Showing
1 changed file
with
2 additions
and
20 deletions
openbr/plugins/format.cpp
| @@ -16,6 +16,7 @@ | @@ -16,6 +16,7 @@ | ||
| 16 | 16 | ||
| 17 | #include <QDate> | 17 | #include <QDate> |
| 18 | #include <QSize> | 18 | #include <QSize> |
| 19 | +#include <QChar> | ||
| 19 | #ifndef BR_EMBEDDED | 20 | #ifndef BR_EMBEDDED |
| 20 | #include <QtXml> | 21 | #include <QtXml> |
| 21 | #endif // BR_EMBEDDED | 22 | #endif // BR_EMBEDDED |
| @@ -774,13 +775,11 @@ BR_REGISTER(Format, scoresFormat) | @@ -774,13 +775,11 @@ BR_REGISTER(Format, scoresFormat) | ||
| 774 | * \author Scott Klum \cite sklum | 775 | * \author Scott Klum \cite sklum |
| 775 | * | 776 | * |
| 776 | */ | 777 | */ |
| 777 | -#include <QTextStream> | ||
| 778 | -#include <QChar> | ||
| 779 | class ebtsFormat : public Format | 778 | class ebtsFormat : public Format |
| 780 | { | 779 | { |
| 781 | Q_OBJECT | 780 | Q_OBJECT |
| 782 | 781 | ||
| 783 | - QByteArray textFieldValue(const QByteArray &byteArray, const QString &fieldNumber, int from = 0) const | 782 | + QString textFieldValue(const QByteArray &byteArray, const QString &fieldNumber, int from = 0) const |
| 784 | { | 783 | { |
| 785 | // Find the field, skip the number bytes, and account for the semicolon | 784 | // Find the field, skip the number bytes, and account for the semicolon |
| 786 | int fieldPosition = byteArray.indexOf(fieldNumber, from) + fieldNumber.size() + 1; | 785 | int fieldPosition = byteArray.indexOf(fieldNumber, from) + fieldNumber.size() + 1; |
| @@ -788,18 +787,6 @@ class ebtsFormat : public Format | @@ -788,18 +787,6 @@ class ebtsFormat : public Format | ||
| 788 | 787 | ||
| 789 | return byteArray.mid(fieldPosition,sepPosition-fieldPosition); | 788 | return byteArray.mid(fieldPosition,sepPosition-fieldPosition); |
| 790 | } | 789 | } |
| 791 | -; | ||
| 792 | -QString fieldValue(const QByteArray &byteArray, const QString &fieldNumber, int from = 0) const | ||
| 793 | -{ | ||
| 794 | - QString fullField = fieldNumber + ".001:"; | ||
| 795 | - | ||
| 796 | - // Find the field, skip the number bytes, and account for the semicolon | ||
| 797 | - int fieldPosition = byteArray.indexOf(fullField, from); | ||
| 798 | - | ||
| 799 | - int sepPosition = byteArray.indexOf(QChar(0x1C),fieldPosition); | ||
| 800 | - | ||
| 801 | - return byteArray.mid(fieldPosition,sepPosition-fieldPosition); | ||
| 802 | -} | ||
| 803 | 790 | ||
| 804 | Template read() const | 791 | Template read() const |
| 805 | { | 792 | { |
| @@ -810,10 +797,6 @@ QString fieldValue(const QByteArray &byteArray, const QString &fieldNumber, int | @@ -810,10 +797,6 @@ QString fieldValue(const QByteArray &byteArray, const QString &fieldNumber, int | ||
| 810 | 797 | ||
| 811 | Mat m; | 798 | Mat m; |
| 812 | 799 | ||
| 813 | - qDebug() << fieldValue(byteArray, "1"); | ||
| 814 | - qDebug() << fieldValue(byteArray, "2"); | ||
| 815 | - | ||
| 816 | - | ||
| 817 | // Demographics | 800 | // Demographics |
| 818 | { | 801 | { |
| 819 | QString name = textFieldValue(byteArray, "2.018"); | 802 | QString name = textFieldValue(byteArray, "2.018"); |
| @@ -844,7 +827,6 @@ QString fieldValue(const QByteArray &byteArray, const QString &fieldNumber, int | @@ -844,7 +827,6 @@ QString fieldValue(const QByteArray &byteArray, const QString &fieldNumber, int | ||
| 844 | 827 | ||
| 845 | m = imdecode(Mat(3, data.size(), CV_8UC3, data.data()), CV_LOAD_IMAGE_COLOR); | 828 | m = imdecode(Mat(3, data.size(), CV_8UC3, data.data()), CV_LOAD_IMAGE_COLOR); |
| 846 | if (!m.data) qWarning("ebtsFormat::read failed to decode image data."); | 829 | if (!m.data) qWarning("ebtsFormat::read failed to decode image data."); |
| 847 | - | ||
| 848 | t.m() = m; | 830 | t.m() = m; |
| 849 | } else qWarning("ebtsFormat::cannot find image data within file."); | 831 | } else qWarning("ebtsFormat::cannot find image data within file."); |
| 850 | 832 |