Commit 896d264e6632c73d2757290a55c68acf044d9b18
1 parent
e5f90101
remove hist
Showing
1 changed file
with
0 additions
and
67 deletions
openbr/plugins/output/hist.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/qtutils.h> | |
| 19 | - | |
| 20 | -namespace br | |
| 21 | -{ | |
| 22 | - | |
| 23 | -/*! | |
| 24 | - * \ingroup outputs | |
| 25 | - * \brief Score histogram. | |
| 26 | - * \author Josh Klontz \cite jklontz | |
| 27 | - */ | |
| 28 | -class histOutput : public Output | |
| 29 | -{ | |
| 30 | - Q_OBJECT | |
| 31 | - | |
| 32 | - float min, max, step; | |
| 33 | - QVector<int> bins; | |
| 34 | - | |
| 35 | - ~histOutput() | |
| 36 | - { | |
| 37 | - if (file.isNull() || bins.isEmpty()) return; | |
| 38 | - QStringList counts; | |
| 39 | - foreach (int count, bins) | |
| 40 | - counts.append(QString::number(count)); | |
| 41 | - const QString result = counts.join(","); | |
| 42 | - QtUtils::writeFile(file, result); | |
| 43 | - } | |
| 44 | - | |
| 45 | - void initialize(const FileList &targetFiles, const FileList &queryFiles) | |
| 46 | - { | |
| 47 | - Output::initialize(targetFiles, queryFiles); | |
| 48 | - min = file.get<float>("min", -5); | |
| 49 | - max = file.get<float>("max", 5); | |
| 50 | - step = file.get<float>("step", 0.1); | |
| 51 | - bins = QVector<int>((max-min)/step, 0); | |
| 52 | - } | |
| 53 | - | |
| 54 | - void set(float value, int i, int j) | |
| 55 | - { | |
| 56 | - (void) i; | |
| 57 | - (void) j; | |
| 58 | - if ((value < min) || (value >= max)) return; | |
| 59 | - bins[(value-min)/step]++; // This should technically be locked to ensure atomic increment | |
| 60 | - } | |
| 61 | -}; | |
| 62 | - | |
| 63 | -BR_REGISTER(Output, histOutput) | |
| 64 | - | |
| 65 | -} // namespace br | |
| 66 | - | |
| 67 | -#include "output/hist.moc" |