Commit 4e621b83b58cb2228c8b234c5183d21186422290
1 parent
5a1f12b8
removed raw format
Showing
1 changed file
with
0 additions
and
60 deletions
openbr/plugins/format/raw.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 | -using namespace cv; | |
| 21 | - | |
| 22 | -namespace br | |
| 23 | -{ | |
| 24 | - | |
| 25 | -/*! | |
| 26 | - * \ingroup formats | |
| 27 | - * \brief RAW format | |
| 28 | - * | |
| 29 | - * \author Scott Klum \cite sklum | |
| 30 | - */ | |
| 31 | -class rawFormat : public Format | |
| 32 | -{ | |
| 33 | - Q_OBJECT | |
| 34 | - | |
| 35 | - Template read() const | |
| 36 | - { | |
| 37 | - QByteArray data; | |
| 38 | - QtUtils::readFile(file, data); | |
| 39 | - | |
| 40 | - // The raw file format has no header information, so one must specify resolution | |
| 41 | - QSize size = QSize(file.get<int>("width"),file.get<int>("height")); | |
| 42 | - Template t(file); | |
| 43 | - QList<Mat> matrices; | |
| 44 | - const int bytes = size.width()*size.height(); | |
| 45 | - for (int i=0; i<data.size()/(size.height()*size.width()); i++) | |
| 46 | - t.append(Mat(size.height(), size.width(), CV_8UC1, data.data()+bytes*i).clone()); | |
| 47 | - return t; | |
| 48 | - } | |
| 49 | - | |
| 50 | - void write(const Template &t) const | |
| 51 | - { | |
| 52 | - QtUtils::writeFile(file, QByteArray().setRawData((const char*)t.m().data, t.m().total() * t.m().elemSize())); | |
| 53 | - } | |
| 54 | -}; | |
| 55 | - | |
| 56 | -BR_REGISTER(Format, rawFormat) | |
| 57 | - | |
| 58 | -} // namespace br | |
| 59 | - | |
| 60 | -#include "format/raw.moc" |