Commit 1dffec6c1f93028fddf2631c48c84618cdeec765
1 parent
7857e552
removed arff format
Showing
1 changed file
with
0 additions
and
67 deletions
openbr/plugins/gallery/arff.cpp deleted
| 1 | -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | ||
| 2 | - * Copyright 2012 The MITRE Corporation * | ||
| 3 | - * * | ||
| 4 | - * Licensed under the Apache License, Version 2.0 (the "License"); * | ||
| 5 | - * you may not use this file except in compliance with the License. * | ||
| 6 | - * You may obtain a copy of the License at * | ||
| 7 | - * * | ||
| 8 | - * http://www.apache.org/licenses/LICENSE-2.0 * | ||
| 9 | - * * | ||
| 10 | - * Unless required by applicable law or agreed to in writing, software * | ||
| 11 | - * distributed under the License is distributed on an "AS IS" BASIS, * | ||
| 12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * | ||
| 13 | - * See the License for the specific language governing permissions and * | ||
| 14 | - * limitations under the License. * | ||
| 15 | - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | ||
| 16 | - | ||
| 17 | -#include <openbr/plugins/openbr_internal.h> | ||
| 18 | -#include <openbr/core/opencvutils.h> | ||
| 19 | - | ||
| 20 | -namespace br | ||
| 21 | -{ | ||
| 22 | - | ||
| 23 | -/*! | ||
| 24 | - * \ingroup galleries | ||
| 25 | - * \brief Weka ARFF file format. | ||
| 26 | - * \author Josh Klontz \cite jklontz | ||
| 27 | - * \br_link http://weka.wikispaces.com/ARFF+%28stable+version%29 | ||
| 28 | - */ | ||
| 29 | -class arffGallery : public Gallery | ||
| 30 | -{ | ||
| 31 | - Q_OBJECT | ||
| 32 | - QFile arffFile; | ||
| 33 | - | ||
| 34 | - TemplateList readBlock(bool *done) | ||
| 35 | - { | ||
| 36 | - (void) done; | ||
| 37 | - qFatal("Not implemented."); | ||
| 38 | - return TemplateList(); | ||
| 39 | - } | ||
| 40 | - | ||
| 41 | - void write(const Template &t) | ||
| 42 | - { | ||
| 43 | - if (!arffFile.isOpen()) { | ||
| 44 | - arffFile.setFileName(file.name); | ||
| 45 | - arffFile.open(QFile::WriteOnly); | ||
| 46 | - arffFile.write("% OpenBR templates\n" | ||
| 47 | - "@RELATION OpenBR\n" | ||
| 48 | - "\n"); | ||
| 49 | - | ||
| 50 | - const int dimensions = t.m().rows * t.m().cols; | ||
| 51 | - for (int i=0; i<dimensions; i++) | ||
| 52 | - arffFile.write(qPrintable("@ATTRIBUTE v" + QString::number(i) + " REAL\n")); | ||
| 53 | - arffFile.write(qPrintable("@ATTRIBUTE class string\n")); | ||
| 54 | - | ||
| 55 | - arffFile.write("\n@DATA\n"); | ||
| 56 | - } | ||
| 57 | - | ||
| 58 | - arffFile.write(qPrintable(OpenCVUtils::matrixToStringList(t).join(','))); | ||
| 59 | - arffFile.write(qPrintable(",'" + t.file.get<QString>("Label") + "'\n")); | ||
| 60 | - } | ||
| 61 | -}; | ||
| 62 | - | ||
| 63 | -BR_REGISTER(Gallery, arffGallery) | ||
| 64 | - | ||
| 65 | -} // namespace br | ||
| 66 | - | ||
| 67 | -#include "gallery/arff.moc" |