From 5614859928c1352c2f4116efcefc398b45416608 Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Mon, 25 Feb 2013 15:57:09 -0500 Subject: [PATCH] Fatal messages need no longer include file/class/function context information --- sdk/core/bee.cpp | 26 +++++++++++++------------- sdk/core/classify.cpp | 8 ++++---- sdk/core/cluster.cpp | 10 +++++----- sdk/core/common.cpp | 2 +- sdk/core/fuse.cpp | 18 +++++++++--------- sdk/core/opencvutils.cpp | 17 ++++++++--------- sdk/core/plot.cpp | 4 ++-- sdk/core/qtutils.cpp | 28 ++++++++++++++-------------- sdk/openbr_plugin.cpp | 14 +++++++------- sdk/openbr_plugin.h | 2 +- sdk/plugins/cascade.cpp | 4 ++-- sdk/plugins/distance.cpp | 2 +- sdk/plugins/eigen3.cpp | 4 ++-- sdk/plugins/eyes.cpp | 4 ++-- sdk/plugins/fill.cpp | 2 +- sdk/plugins/filter.cpp | 4 ++-- sdk/plugins/format.cpp | 24 ++++++++++++------------ sdk/plugins/gallery.cpp | 8 ++++---- sdk/plugins/keypoint.cpp | 6 +++--- sdk/plugins/lbp.cpp | 2 +- sdk/plugins/mask.cpp | 2 +- sdk/plugins/meta.cpp | 15 +++++++++------ sdk/plugins/normalize.cpp | 2 +- sdk/plugins/pixel.cpp | 1 - sdk/plugins/pp5.cpp | 2 +- sdk/plugins/quantize.cpp | 2 +- sdk/plugins/reduce.cpp | 4 ++-- sdk/plugins/regions.cpp | 2 +- sdk/plugins/svm.cpp | 2 +- sdk/plugins/synthetic.cpp | 2 +- sdk/plugins/wavelet.cpp | 4 ++-- 31 files changed, 114 insertions(+), 113 deletions(-) diff --git a/sdk/core/bee.cpp b/sdk/core/bee.cpp index 430d949..1cc8a61 100644 --- a/sdk/core/bee.cpp +++ b/sdk/core/bee.cpp @@ -42,8 +42,8 @@ FileList BEE::readSigset(const QString &sigset, bool ignoreMetadata) QDomDocument doc(sigset); QFile file(sigset); bool success; - success = file.open(QIODevice::ReadOnly); if (!success) qFatal("BEE::readSigset unable to open %s for reading.", qPrintable(sigset)); - success = doc.setContent(&file); if (!success) qFatal("BEE::readSigset unable to parse %s.", qPrintable(sigset)); + success = file.open(QIODevice::ReadOnly); if (!success) qFatal("Unable to open %s for reading.", qPrintable(sigset)); + success = doc.setContent(&file); if (!success) qFatal("Unable to parse %s.", qPrintable(sigset)); file.close(); QDomElement docElem = doc.documentElement(); @@ -75,7 +75,7 @@ FileList BEE::readSigset(const QString &sigset, bool ignoreMetadata) } } - if (file.isNull()) qFatal("BEE::readSigset empty file-name in %s.", qPrintable(sigset)); + if (file.isNull()) qFatal("Empty file-name in %s.", qPrintable(sigset)); fileList.append(file); fileNode = fileNode.nextSibling(); @@ -115,7 +115,7 @@ Mat readMatrix(const br::File &matrix) if (matrix == "Matrix") { const int size = matrix.getInt("Size"); const int step = matrix.getInt("Step", 1); - if (size % step != 0) qFatal("bee.cpp readMatrix step does not divide size evenly."); + if (size % step != 0) qFatal("Step does not divide size evenly."); if (sizeof(T) == sizeof(BEE::Mask_t)) { const bool selfSimilar = matrix.getBool("SelfSimilar"); @@ -140,12 +140,12 @@ Mat readMatrix(const br::File &matrix) QFile file(matrix); bool success = file.open(QFile::ReadOnly); - if (!success) qFatal("bee.cpp readMatrix unable to open %s for reading.", qPrintable((QString)matrix)); + if (!success) qFatal("Unable to open %s for reading.", qPrintable((QString)matrix)); // Check format QByteArray format = file.readLine(); bool isDistance = (format[0] == 'D'); - if (format[1] != '2') qFatal("bee.cpp readMatrix invalid matrix header."); + if (format[1] != '2') qFatal("Invalid matrix header."); // Skip sigset lines file.readLine(); @@ -160,7 +160,7 @@ Mat readMatrix(const br::File &matrix) qint64 bytesExpected = (qint64)rows*(qint64)cols*(qint64)sizeof(T); Mat m(rows, cols, OpenCVType::make()); if (file.read((char*)m.data, bytesExpected) != bytesExpected) - qFatal("bee.cpp readMatrix invalid matrix size."); + qFatal("Invalid matrix size."); file.close(); Mat result; @@ -182,17 +182,17 @@ Mat BEE::readMask(const br::File &mask) template void writeMatrix(const Mat &m, const QString &matrix, const QString &targetSigset, const QString &querySigset) { - if (m.type() != OpenCVType::make()) qFatal("bee.cpp writeMatrix invalid matrix type."); + if (m.type() != OpenCVType::make()) qFatal("Invalid matrix type."); int elemSize = sizeof(T); QString matrixType; if (elemSize == 1) matrixType = "B"; else if (elemSize == 4) matrixType = "F"; - else qFatal("bee.cpp writeMatrix invalid element size.\n"); + else qFatal("Invalid element size."); char buff[4]; QFile file(matrix); - bool success = file.open(QFile::WriteOnly); if (!success) qFatal("bee.cpp writeMatrix unable to open %s for writing.", qPrintable(matrix)); + bool success = file.open(QFile::WriteOnly); if (!success) qFatal("Unable to open %s for writing.", qPrintable(matrix)); file.write("S2\n"); file.write(qPrintable(QFileInfo(targetSigset).fileName())); file.write("\n"); @@ -265,12 +265,12 @@ void BEE::combineMasks(const QStringList &inputMasks, const QString &outputMask, bool AND = true; if (method == "And") AND = true; else if (method == "Or") AND = false; - else qFatal("combineMasks invalid method"); + else qFatal("Invalid method."); QList masks; foreach (const QString &inputMask, inputMasks) masks.append(readMask(inputMask)); - if (masks.size() < 2) qFatal("BEE::mergeMasks expects at least two masks."); + if (masks.size() < 2) qFatal("Expected at least two masks."); const int rows = masks.first().rows; const int columns = masks.first().cols; @@ -294,7 +294,7 @@ void BEE::combineMasks(const QStringList &inputMasks, const QString &outputMask, break; } } - if ((genuineCount != 0) && (imposterCount != 0)) qFatal("BEE::combinedMasks comparison is both a genuine and an imposter."); + if ((genuineCount != 0) && (imposterCount != 0)) qFatal("Comparison is both a genuine and an imposter."); Mask_t val; if (genuineCount > 0) val = Match; diff --git a/sdk/core/classify.cpp b/sdk/core/classify.cpp index 4bdc620..411b7d2 100644 --- a/sdk/core/classify.cpp +++ b/sdk/core/classify.cpp @@ -39,12 +39,12 @@ void br::EvalClassification(const QString &predictedInput, const QString &truthI TemplateList predicted(TemplateList::fromInput(predictedInput)); TemplateList truth(TemplateList::fromInput(truthInput)); - if (predicted.size() != truth.size()) qFatal("br::EvalClassification input size mismatch."); + if (predicted.size() != truth.size()) qFatal("Input size mismatch."); QHash counters; for (int i=0; i::max(); int numGalleries = (int)sqrt((float)simmats.size()); if (numGalleries*numGalleries != simmats.size()) - qFatal("cluser.cpp readGalleries incorrect number of similarity matrices."); + qFatal("Incorrect number of similarity matrices."); // Process each simmat for (int i=0; i Common::RandSample(int n, int max, int min, bool unique) QList samples; samples.reserve(n); int range = max-min; - if (range <= 0) qFatal("Common::RandSample non-positive range."); + if (range <= 0) qFatal("Non-positive range."); if (unique && (n >= range)) { for (int i=min; i(i,j) == BEE::DontCare) continue; @@ -71,7 +71,7 @@ static void normalizeMatrix(Mat &matrix, const Mat &mask, const QString &method) } } } else { - qFatal("fuse.cpp normalizeMatrix invalid normalization method %s.", qPrintable(method)); + qFatal("Invalid normalization method %s.", qPrintable(method)); } } @@ -81,8 +81,8 @@ void br::Fuse(const QStringList &inputSimmats, const QString &mask, const QStrin QList matrices; foreach (const QString &simmat, inputSimmats) matrices.append(BEE::readSimmat(simmat)); - if ((matrices.size() < 2) && (fusion != "None")) qFatal("br::Fuse expected at least two similarity matrices."); - if ((matrices.size() > 1) && (fusion == "None")) qFatal("mm:Fuse expected exactly one similarity matrix."); + if ((matrices.size() < 2) && (fusion != "None")) qFatal("Expected at least two similarity matrices."); + if ((matrices.size() > 1) && (fusion == "None")) qFatal("Expected exactly one similarity matrix."); Mat matrix_mask = BEE::readMask(mask); for (int i=0; i &src, int rows) { if (rows == -1) rows = src.size(); int columns = src.isEmpty() ? 0 : src.size() / rows; - if (rows*columns != src.size()) qFatal("OpenCVUtils::toMat invalid matrix size."); + if (rows*columns != src.size()) qFatal("Invalid matrix size."); Mat dst(rows, columns, CV_32FC1); for (int i=0; i(i/columns,i%columns) = src[i]; @@ -131,7 +131,7 @@ Mat OpenCVUtils::toMat(const QList &src) for (int i=0; i &src) int row = 0; foreach (const Mat &m, src) { if ((m.cols != cols) || (m.type() != type) || (!m.isContinuous())) - qFatal("OpenCVUtils::toMatByRow invalid matrix."); + qFatal("Invalid matrix."); memcpy(dst.ptr(row), m.ptr(), m.rows*m.cols*m.elemSize()); row += m.rows; } @@ -167,7 +167,7 @@ QString OpenCVUtils::elemToString(const Mat &m, int r, int c) case CV_32S: return QString::number(m.at(r,c)); case CV_32F: return QString::number(m.at(r,c)); case CV_64F: return QString::number(m.at(r,c)); - default: qFatal("OpenCVUtils::elemToString unknown matrix depth"); + default: qFatal("Unknown matrix depth"); } return "?"; } @@ -183,7 +183,7 @@ float OpenCVUtils::elemToFloat(const Mat &m, int r, int c) case CV_32S: return float(m.at(r,c)); case CV_32F: return float(m.at(r,c)); case CV_64F: return float(m.at(r,c)); - default: qFatal("OpenCVUtils::elemToFloat unknown matrix depth"); + default: qFatal("Unknown matrix depth"); } return 0; } @@ -300,10 +300,9 @@ QDataStream &operator<<(QDataStream &stream, const Mat &m) int len = rows*cols*m.elemSize(); stream << len; if (len > 0) { - if (!m.isContinuous()) qFatal("opencvutils.cpp operator<< Mat can't serialize non-continuous matrices."); + if (!m.isContinuous()) qFatal("Can't serialize non-continuous matrices."); int written = stream.writeRawData((const char*)m.data, len); - - if (written != len) qFatal("opencvutils.cpp operator<< Mat serialization failure."); + if (written != len) qFatal("Serialization failure."); } return stream; } diff --git a/sdk/core/plot.cpp b/sdk/core/plot.cpp index 9ce14fb..9e053e4 100644 --- a/sdk/core/plot.cpp +++ b/sdk/core/plot.cpp @@ -309,7 +309,7 @@ struct RPlot RPlot(QStringList files, const br::File &destination, bool isEvalFormat = true) { - if (files.isEmpty()) qFatal("RPlot::RPlot() empty file list."); + if (files.isEmpty()) qFatal("Empty file list."); qSort(files.begin(), files.end(), sortFiles); // Parse destination @@ -320,7 +320,7 @@ struct RPlot file.setFileName(basename+".R"); bool success = file.open(QFile::WriteOnly); - if (!success) qFatal("RPlot::RPlot() failed to open %s for writing.", qPrintable(file.fileName())); + if (!success) qFatal("Failed to open %s for writing.", qPrintable(file.fileName())); file.write("# Load libraries\n" "library(ggplot2)\n" diff --git a/sdk/core/qtutils.cpp b/sdk/core/qtutils.cpp index 563b9d7..be837d1 100644 --- a/sdk/core/qtutils.cpp +++ b/sdk/core/qtutils.cpp @@ -44,7 +44,7 @@ QStringList QtUtils::getFiles(QDir dir, bool recursive) foreach (const QString &folder, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) { QDir subdir(dir); - bool success = subdir.cd(folder); if (!success) qFatal("QtUtils::getFiles cd failure."); + bool success = subdir.cd(folder); if (!success) qFatal("cd failure."); files.append(getFiles(subdir, true)); } return files; @@ -74,7 +74,7 @@ QStringList QtUtils::readLines(const QString &file) void QtUtils::readFile(const QString &file, QStringList &lines) { QFile f(file); - if (!f.open(QFile::ReadOnly)) qFatal("QtUtils::readFile unable to open %s for reading.", qPrintable(file)); + if (!f.open(QFile::ReadOnly)) qFatal("Unable to open %s for reading.", qPrintable(file)); lines = QString(f.readAll()).split('\n', QString::SkipEmptyParts); for (int i=0; i QtUtils::toFloats(const QStringList &strings) bool ok; foreach (const QString &string, strings) { floats.append(string.toFloat(&ok)); - if (!ok) qFatal("QtUtils::toFloats failed to convert %s to floating point format.", qPrintable(string)); + if (!ok) qFatal("Failed to convert %s to floating point format.", qPrintable(string)); } return floats; } @@ -239,13 +239,13 @@ QStringList QtUtils::parse(QString args, char split) } else if ((args[i] == '(') || (args[i] == '[') || (args[i] == '<') || (args[i] == '{')) { subexpressions.push(args[i]); } else if (args[i] == ')') { - if (subexpressions.pop() != '(') qFatal("QtUtils::parse unexpected ')'."); + if (subexpressions.pop() != '(') qFatal("Unexpected ')'."); } else if (args[i] == ']') { - if (subexpressions.pop() != '[') qFatal("QtUtils::parse unexpected ']'."); + if (subexpressions.pop() != '[') qFatal("Unexpected ']'."); } else if (args[i] == '>') { - if (subexpressions.pop() != '<') qFatal("QtUtils::parse unexpected '>'."); + if (subexpressions.pop() != '<') qFatal("Unexpected '>'."); } else if (args[i] == '}') { - if (subexpressions.pop() != '{') qFatal("QtUtils::parse unexpected '}'."); + if (subexpressions.pop() != '{') qFatal("Unexpected '}'."); } else if (subexpressions.isEmpty() && (args[i] == split)) { words.append(args.mid(start, i-start).trimmed()); start = i+1; diff --git a/sdk/openbr_plugin.cpp b/sdk/openbr_plugin.cpp index 992ea01..acd55f9 100644 --- a/sdk/openbr_plugin.cpp +++ b/sdk/openbr_plugin.cpp @@ -155,7 +155,7 @@ void File::set(const QString &key, const QVariant &value) QVariant File::get(const QString &key) const { - if (!contains(key)) qFatal("File::get missing key: %s", qPrintable(key)); + if (!contains(key)) qFatal("Missing key: %s", qPrintable(key)); return value(key); } @@ -182,9 +182,9 @@ void File::setBool(const QString &key, bool value) int File::getInt(const QString &key) const { - if (!contains(key)) qFatal("File::getInt missing key: %s", qPrintable(key)); + if (!contains(key)) qFatal("Missing key: %s", qPrintable(key)); bool ok; int result = value(key).toInt(&ok); - if (!ok) qFatal("File::getInt invalid conversion from: %s", qPrintable(getString(key))); + if (!ok) qFatal("Invalid conversion from: %s", qPrintable(getString(key))); return result; } @@ -198,9 +198,9 @@ int File::getInt(const QString &key, int defaultValue) const float File::getFloat(const QString &key) const { - if (!contains(key)) qFatal("File::getFloat missing key: %s", qPrintable(key)); + if (!contains(key)) qFatal("Missing key: %s", qPrintable(key)); bool ok; float result = value(key).toFloat(&ok); - if (!ok) qFatal("File::getFloat invalid conversion from: %s", qPrintable(getString(key))); + if (!ok) qFatal("Invalid conversion from: %s", qPrintable(getString(key))); return result; } @@ -214,7 +214,7 @@ float File::getFloat(const QString &key, float defaultValue) const QString File::getString(const QString &key) const { - if (!contains(key)) qFatal("File::getString missing key: %s", qPrintable(key)); + if (!contains(key)) qFatal("Missing key: %s", qPrintable(key)); return value(key).toString(); } @@ -657,7 +657,7 @@ void Object::setProperty(const QString &name, const QString &value) QVariant variant; if (type.startsWith("QList<") && type.endsWith(">")) { - if (!value.startsWith('[')) qFatal("Object::setProperty expected a list."); + if (!value.startsWith('[')) qFatal("Expected a list."); const QStringList strings = parse(value.mid(1, value.size()-2)); if (type == "QList") { diff --git a/sdk/openbr_plugin.h b/sdk/openbr_plugin.h index 4687d85..fbd7e16 100644 --- a/sdk/openbr_plugin.h +++ b/sdk/openbr_plugin.h @@ -277,7 +277,7 @@ struct Template : public QList Template(const cv::Mat &mat) { append(mat); } /*!< \brief Append a matrix. */ inline const cv::Mat &m() const { static const cv::Mat NullMatrix; - return isEmpty() ? qFatal("Template::m() empty template."), NullMatrix : last(); } /*!< \brief Idiom to treat the template as a matrix. */ + return isEmpty() ? qFatal("Empty template."), NullMatrix : last(); } /*!< \brief Idiom to treat the template as a matrix. */ inline cv::Mat &m() { return isEmpty() ? append(cv::Mat()), last() : last(); } /*!< \brief Idiom to treat the template as a matrix. */ inline cv::Mat &operator=(const cv::Mat &other) { return m() = other; } /*!< \brief Idiom to treat the template as a matrix. */ inline operator const cv::Mat&() const { return m(); } /*!< \brief Idiom to treat the template as a matrix. */ diff --git a/sdk/plugins/cascade.cpp b/sdk/plugins/cascade.cpp index 52df952..480ab7b 100644 --- a/sdk/plugins/cascade.cpp +++ b/sdk/plugins/cascade.cpp @@ -37,7 +37,7 @@ public: else if (model == "Eye") file += "haarcascades/haarcascade_eye_tree_eyeglasses.xml"; else if (model == "FrontalFace") file += "haarcascades/haarcascade_frontalface_alt2.xml"; else if (model == "ProfileFace") file += "haarcascades/haarcascade_profileface.xml"; - else qFatal("CascadeResourceMaker::CascadeResourceMaker invalid model."); + else qFatal("Invalid model."); } private: @@ -45,7 +45,7 @@ private: { CascadeClassifier *cascade = new CascadeClassifier(); if (!cascade->load(file.toStdString())) - qFatal("CascadeResourceMaker::make failed to load: %s", qPrintable(file)); + qFatal("Failed to load: %s", qPrintable(file)); return cascade; } }; diff --git a/sdk/plugins/distance.cpp b/sdk/plugins/distance.cpp index a7305e7..734dd95 100644 --- a/sdk/plugins/distance.cpp +++ b/sdk/plugins/distance.cpp @@ -87,7 +87,7 @@ private: } if (result != result) - qFatal("Dist::compare NaN result."); + qFatal("NaN result."); return -log(result+1); } diff --git a/sdk/plugins/eigen3.cpp b/sdk/plugins/eigen3.cpp index 3431d1b..557af04 100644 --- a/sdk/plugins/eigen3.cpp +++ b/sdk/plugins/eigen3.cpp @@ -82,7 +82,7 @@ private: void train(const TemplateList &trainingSet) { if (trainingSet.first().m().type() != CV_32FC1) - qFatal("PCA::train requires single channel 32-bit floating point matrices."); + qFatal("Requires single channel 32-bit floating point matrices."); originalRows = trainingSet.first().m().rows; int dimsIn = trainingSet.first().m().rows * trainingSet.first().m().cols; @@ -156,7 +156,7 @@ private: } } else { if (keep + drop > allEVals.rows()) - qFatal("PCA::train insufficient samples, needed at least %d but only got %d.", (int)keep + drop, (int)allEVals.rows()); + qFatal("Insufficient samples, needed at least %d but only got %d.", (int)keep + drop, (int)allEVals.rows()); } // Keep highest energy vectors diff --git a/sdk/plugins/eyes.cpp b/sdk/plugins/eyes.cpp index c4b61c1..233ed6e 100644 --- a/sdk/plugins/eyes.cpp +++ b/sdk/plugins/eyes.cpp @@ -71,10 +71,10 @@ public: // Open the eye locator model file.setFileName(Globals->sdkPath + "/share/openbr/models/EyeLocatorASEF128x128.fel"); - bool success = file.open(QFile::ReadOnly); if (!success) qFatal("ASEFEyes::ASEFEyes failed to open %s for reading.", qPrintable(file.fileName())); + if (!file.open(QFile::ReadOnly)) qFatal("Failed to open %s for reading.", qPrintable(file.fileName())); // Check the first line - line = file.readLine().simplified(); if (line != "CFEL") qFatal("ASEFEyes::ASEFEyes invalid header."); + if (file.readLine().simplified() != "CFEL") qFatal("Invalid header."); // Read past the comment and copyright. file.readLine(); diff --git a/sdk/plugins/fill.cpp b/sdk/plugins/fill.cpp index a739c2f..f812535 100644 --- a/sdk/plugins/fill.cpp +++ b/sdk/plugins/fill.cpp @@ -114,7 +114,7 @@ class BlendTransform : public UntrainableMetaTransform void project(const Template &src, Template &dst) const { - if (src.size() != 2) qFatal("Blend::project expected two source matrices."); + if (src.size() != 2) qFatal("Expected two source matrices."); addWeighted(src[0], alpha, src[1], 1-alpha, 0, dst); } }; diff --git a/sdk/plugins/filter.cpp b/sdk/plugins/filter.cpp index 1d2aa9c..affeb71 100644 --- a/sdk/plugins/filter.cpp +++ b/sdk/plugins/filter.cpp @@ -130,7 +130,7 @@ class CSDNTransform : public UntrainableTransform void project(const Template &src, Template &dst) const { - if (src.m().channels() != 1) qFatal("ContrastEq::project expected single channel source matrix."); + if (src.m().channels() != 1) qFatal("Expected single channel source matrix."); const int nRows = src.m().rows; const int nCols = src.m().cols; @@ -180,7 +180,7 @@ class ContrastEqTransform : public UntrainableTransform void project(const Template &src, Template &dst) const { - if (src.m().channels() != 1) qFatal("ContrastEq::project expected single channel source matrix."); + if (src.m().channels() != 1) qFatal("Expected single channel source matrix."); // Stage 1 Mat stage1; diff --git a/sdk/plugins/format.cpp b/sdk/plugins/format.cpp index a0106c6..5a4fea2 100644 --- a/sdk/plugins/format.cpp +++ b/sdk/plugins/format.cpp @@ -112,7 +112,7 @@ class binFormat : public Format { Mat m; t.m().convertTo(m, CV_32F); - if (m.channels() != 1) qFatal("binFormat::write only supports single channel matrices."); + if (m.channels() != 1) qFatal("Only supports single channel matrices."); QByteArray data; QDataStream stream(&data, QFile::WriteOnly); @@ -168,8 +168,8 @@ class csvFormat : public Format void write(const Template &t) const { const Mat &m = t.m(); - if (t.size() != 1) qFatal("csvFormat::write only supports single matrix templates."); - if (m.channels() != 1) qFatal("csvFormat::write only supports single channel matrices."); + if (t.size() != 1) qFatal("Only supports single matrix templates."); + if (m.channels() != 1) qFatal("Only supports single channel matrices."); QStringList lines; lines.reserve(m.rows); for (int r=0; r 1) qFatal("memGallery::align can't handle multi-matrix template %s.", qPrintable(t.file.flat())); + if (t.size() > 1) qFatal("Can't handle multi-matrix template %s.", qPrintable(t.file.flat())); cv::Mat &m = t; if (m.data) { const size_t size = m.total() * m.elemSize(); - if (!m.isContinuous()) qFatal("memGallery::align requires continuous matrix data of size %d for %s.", (int)size, qPrintable(t.file.flat())); + if (!m.isContinuous()) qFatal("Requires continuous matrix data of size %d for %s.", (int)size, qPrintable(t.file.flat())); memcpy(&(alignedData.data()[offset]), m.ptr(), size); m = cv::Mat(m.rows, m.cols, m.type(), &(alignedData.data()[offset])); offset += size; @@ -596,7 +596,7 @@ class dbGallery : public Gallery void write(const Template &t) { (void) t; - qFatal("Writing not supported."); + qFatal("Not supported."); } }; @@ -649,7 +649,7 @@ class googleGallery : public Gallery void write(const Template &t) { (void) t; - qFatal("Writing to a txtGallery not supported."); + qFatal("Not supported."); } }; diff --git a/sdk/plugins/keypoint.cpp b/sdk/plugins/keypoint.cpp index 78ee2fb..318d375 100644 --- a/sdk/plugins/keypoint.cpp +++ b/sdk/plugins/keypoint.cpp @@ -42,7 +42,7 @@ class KeyPointDetectorTransform : public UntrainableTransform { featureDetector = FeatureDetector::create(detector.toStdString()); if (featureDetector.empty()) - qFatal("KeyPointDetector::init failed to create KeyPointDetector: %s", qPrintable(detector)); + qFatal("Failed to create KeyPointDetector: %s", qPrintable(detector)); } void project(const Template &src, Template &dst) const @@ -85,7 +85,7 @@ class KeyPointDescriptorTransform : public UntrainableTransform { descriptorExtractor = DescriptorExtractor::create(descriptor.toStdString()); if (descriptorExtractor.empty()) - qFatal("KeyPointDescriptor::make failed to create DescriptorExtractor: %s", qPrintable(descriptor)); + qFatal("Failed to create DescriptorExtractor: %s", qPrintable(descriptor)); } void project(const Template &src, Template &dst) const @@ -123,7 +123,7 @@ class KeyPointMatcherTransform : public Distance { descriptorMatcher = DescriptorMatcher::create(matcher.toStdString()); if (descriptorMatcher.empty()) - qFatal("KeyPointMatcher::make failed to create DescriptorMatcher: %s", qPrintable(matcher)); + qFatal("Failed to create DescriptorMatcher: %s", qPrintable(matcher)); } float compare(const Template &a, const Template &b) const diff --git a/sdk/plugins/lbp.cpp b/sdk/plugins/lbp.cpp index 6f632fe..3336aab 100644 --- a/sdk/plugins/lbp.cpp +++ b/sdk/plugins/lbp.cpp @@ -171,7 +171,7 @@ class ColoredU2Transform : public UntrainableTransform } if (src.m().type() != CV_8UC1) - qFatal("ColoredU2::project expected 8UC1 source type."); + qFatal("Expected 8UC1 source type."); Mat hue, saturation, value; LUT(src, hueLUT, hue); diff --git a/sdk/plugins/mask.cpp b/sdk/plugins/mask.cpp index b30e3c2..4a20a3c 100644 --- a/sdk/plugins/mask.cpp +++ b/sdk/plugins/mask.cpp @@ -59,7 +59,7 @@ class GradientMaskTransform : public UntrainableTransform void project(const Template &src, Template &dst) const { const Mat &m = src.m(); - if (m.type() != CV_8UC1) qFatal("GradientMask operates on 8UC1 matrices."); + if (m.type() != CV_8UC1) qFatal("Requires 8UC1 matrices."); Mat n = Mat(m.rows, m.cols, CV_8UC1); n.setTo(255); for (int i=0; i landmarks = t.file.landmarks(); QList ROIs = t.file.ROIs(); - if (landmarks.size() % t.size() != 0) qFatal("TemplateList::simplified uneven landmark count."); - if (ROIs.size() % t.size() != 0) qFatal("TemplateList::simplified uneven ROI count."); + if (landmarks.size() % t.size() != 0) qFatal("Uneven landmark count."); + if (ROIs.size() % t.size() != 0) qFatal("Uneven ROI count."); const int landmarkStep = landmarks.size() / t.size(); const int ROIStep = ROIs.size() / t.size(); @@ -281,7 +281,7 @@ class ForkTransform : public MetaTransform foreach (const Transform *f, transforms) { TemplateList m; f->project(src, m); - if (m.size() != dst.size()) qFatal("Fork::project templateList is of an unexpected size."); + if (m.size() != dst.size()) qFatal("TemplateList is of an unexpected size."); for (int i=0; i> cache; file.close(); @@ -458,7 +460,8 @@ class FTETransform : public Transform QList vals; foreach (const Template &t, projectedData) { - if (!t.file.contains(transform->objectName())) qFatal("FTE::train matrix metadata missing key %s.", qPrintable(transform->objectName())); + if (!t.file.contains(transform->objectName())) + qFatal("Matrix metadata missing key %s.", qPrintable(transform->objectName())); vals.append(t.file.getFloat(transform->objectName())); } float q1, q3; diff --git a/sdk/plugins/normalize.cpp b/sdk/plugins/normalize.cpp index 163699d..6e466d3 100644 --- a/sdk/plugins/normalize.cpp +++ b/sdk/plugins/normalize.cpp @@ -100,7 +100,7 @@ private: if (method == Mean) mean(m.col(i), &A, &B); else if (method == Median) median(m.col(i), &A, &B); else if (method == Range) range(m.col(i), &A, &B); - else qFatal("Center::train invalid method"); + else qFatal("Invalid method."); ca->at(0, i) = A; cb->at(0, i) = B; } diff --git a/sdk/plugins/pixel.cpp b/sdk/plugins/pixel.cpp index 248996b..3514b53 100644 --- a/sdk/plugins/pixel.cpp +++ b/sdk/plugins/pixel.cpp @@ -54,7 +54,6 @@ class PerPixelClassifierTransform : public MetaTransform void rotate(Template &src, Template &dst) const { - //if (src.m().cols%9 != 0) qFatal("Rotation invariance can only be used after Neighbors"); int images = (src.m().cols)/9; dst = src; for (int i = 0; i < images; i++){ diff --git a/sdk/plugins/pp5.cpp b/sdk/plugins/pp5.cpp index 79c24e6..05707b3 100644 --- a/sdk/plugins/pp5.cpp +++ b/sdk/plugins/pp5.cpp @@ -283,7 +283,7 @@ class PP5Compare : public Distance { (void) target; (void) query; - qFatal("PP5Compare::compare (single templates) should never be called!"); + qFatal("Compare single templates should never be called!"); return 0; } diff --git a/sdk/plugins/quantize.cpp b/sdk/plugins/quantize.cpp index 9d8f109..02bd475 100644 --- a/sdk/plugins/quantize.cpp +++ b/sdk/plugins/quantize.cpp @@ -95,7 +95,7 @@ class PackTransform : public UntrainableTransform { const Mat &m = src; if ((m.cols % 2 != 0) || (m.type() != CV_8UC1)) - qFatal("Pack::project invalid template format."); + qFatal("Invalid template format."); Mat n(m.rows, m.cols/2, CV_8UC1); for (int i=0; i sizes(partitions, 0); for (int i=0; i