forked from fanxu/ffld
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Scene.h
103 lines (82 loc) · 3.53 KB
/
Scene.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
//--------------------------------------------------------------------------------------------------
// Implementation of the paper "Exact Acceleration of Linear Object Detectors", 12th European
// Conference on Computer Vision, 2012.
//
// Copyright (c) 2012 Idiap Research Institute, <http://www.idiap.ch/>
// Written by Charles Dubout <[email protected]>
//
// This file is part of FFLD (the Fast Fourier Linear Detector)
//
// FFLD is free software: you can redistribute it and/or modify it under the terms of the GNU
// General Public License version 3 as published by the Free Software Foundation.
//
// FFLD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
// Public License for more details.
//
// You should have received a copy of the GNU General Public License along with FFLD. If not, see
// <http://www.gnu.org/licenses/>.
//--------------------------------------------------------------------------------------------------
#ifndef FFLD_SCENE_H
#define FFLD_SCENE_H
#include "Object.h"
#include <string>
#include <vector>
namespace FFLD
{
/// The Scene class represents a Pascal scene, consisting of a (filename to a) jpeg image and a list
/// of Pascal objects. It stores most of the information present in a Pascal VOC 2007 .xml
/// annotation file. Missing are the <source>, <owner>, and <segmented> fields, as they are
/// irrelevant to the training or testing of object detectors. The <folder> and (image) <filename>
/// fields are also merged together into an absolute filename, derived from the scene filename.
class Scene
{
public:
/// Constructs an empty scene. An empty scene has an empty image and no object.
Scene();
/// Constructs a scene from informations about a jpeg image and a list of objects.
/// @param[in] width Width of the image.
/// @param[in] height Height of the image.
/// @param[in] depth Depth of the image.
/// @param[in] filename Filename of the image.
/// @param[in] objects List of objects present in the scene.
Scene(int width, int height, int depth, const std::string & filename,
const std::vector<Object> & objects);
/// Constructs a scene and tries to load the scene from the xml file with the given
/// @p filename.
Scene(const std::string & filename);
/// Returns the width of the image.
int width() const;
/// Sets the width of the image.
void setWidth(int width);
/// Returns the height of the image.
int height() const;
/// Sets the height of the image.
void setHeight(int height);
/// Returns the depth of the image. The image depth is the number of color channels.
int depth() const;
/// Sets the depth of the image.
void setDepth(int depth);
/// Returns the filename of the image.
const std::string & filename() const;
/// Sets the filename of the image.
void setFilename(const std::string & filename);
/// Returns the list of objects present in the scene.
const std::vector<Object> & objects() const;
/// Sets the list of objects present in the scene.
void setObjects(const std::vector<Object> & objects);
/// Returns whether the scene is empty. An empty scene has an empty image and no object.
bool empty() const;
private:
int width_;
int height_;
int depth_;
std::string filename_;
std::vector<Object> objects_;
};
/// Serializes a scene to a stream.
std::ostream & operator<<(std::ostream & os, const Scene & scene);
/// Unserializes a scene from a stream.
std::istream & operator>>(std::istream & is, Scene & scene);
}
#endif