forked from fanxu/ffld
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Object.h
111 lines (89 loc) · 3.61 KB
/
Object.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
104
105
106
107
108
109
110
111
//--------------------------------------------------------------------------------------------------
// 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_OBJECT_H
#define FFLD_OBJECT_H
#include "Rectangle.h"
#include <iosfwd>
namespace FFLD
{
/// The Object class represents an object in a Scene. It stores all the information present
/// inbetween <object> tags in a Pascal VOC 2007 .xml annotation file, although the bounding box is
/// represented slightly differently (top left coordinates of (0, 0) instead of (1, 1)).
class Object
{
public:
/// The possible object labels.
enum Name
{
AEROPLANE, BICYCLE, BIRD, BOAT, BOTTLE, BUS, CAR, CAT, CHAIR, COW, DININGTABLE, DOG,
HORSE, MOTORBIKE, PERSON, POTTEDPLANT, SHEEP, SOFA, TRAIN, TVMONITOR, UNKNOWN
};
/// The possible object views.
enum Pose
{
FRONTAL, LEFT, REAR, RIGHT, UNSPECIFIED
};
/// Constructs an empty object. An empty object has name 'unknown', pose 'unspecified', and all
/// other parameters set to their default values.
Object();
/// Constructs an object from a name, a pose, annotation flags and a bounding box.
/// @param[in] name Label of the object.
/// @param[in] pose View of the object.
/// @param[in] truncated Whether the object is annotated as being truncated.
/// @param[in] difficult Whether the object is annotated as being difficult.
/// @param[in] bndbox Bounding box of the object.
Object(Name name, Pose pose, bool truncated, bool difficult, Rectangle bndbox);
/// Returns the name (label) of the object.
Name name() const;
/// Sets the name (label) of the object.
void setName(Name name);
/// Returns the pose (view) of the object.
Pose pose() const;
/// Sets the pose (view) of the object.
void setPose(Pose pose);
/// Returns whether the object is annotated as being truncated.
bool truncated() const;
/// Annotates the object as being truncated.
void setTruncated(bool truncated);
/// Returns whether the object is annotated as being difficult.
bool difficult() const;
/// Annotates the object as being difficult.
void setDifficult(bool difficult);
/// Returns the bounding box of the object.
Rectangle bndbox() const;
/// Sets the bounding box of the object.
void setBndbox(Rectangle bndbox);
/// Returns whether the object is empty.
/// An empty object has name 'unknown', pose 'unspecified', and all other parameters set to
/// their default values.
bool empty() const;
private:
Name name_;
Pose pose_;
bool truncated_;
bool difficult_;
Rectangle bndbox_;
};
/// Serializes an object to a stream.
std::ostream & operator<<(std::ostream & os, const Object & obj);
/// Unserializes an object from a stream.
std::istream & operator>>(std::istream & is, Object & obj);
}
#endif