Gazebo Rendering
API Reference
9.0.0
insert_drive_file
Tutorials
library_books
Classes
toc
Namespaces
insert_drive_file
Files
launch
Gazebo Website
Index
List
Hierarchy
Members: All
Members: Functions
Members: Variables
Members: Typedefs
Members: Enumerations
Members: Enumerator
List
Members
Functions
Typedefs
Variables
Enumerations
Enumerator
src
gz-rendering
include
gz
rendering
base
BaseSegmentationCamera.hh
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2021 Open Source Robotics Foundation
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
#ifndef GZ_RENDERING_BASE_BASESEGMENTATIONCAMERA_HH_
18
#define GZ_RENDERING_BASE_BASESEGMENTATIONCAMERA_HH_
19
20
#include <string>
21
22
#include <
gz/common/Event.hh
>
23
24
#include "
gz/rendering/base/BaseCamera.hh
"
25
#include "
gz/rendering/SegmentationCamera.hh
"
26
27
namespace
gz
28
{
29
namespace
rendering
30
{
31
inline
namespace
GZ_RENDERING_VERSION_NAMESPACE {
32
33
template
<
class
T>
34
class
BaseSegmentationCamera
:
35
public
virtual
SegmentationCamera
,
36
public
virtual
BaseCamera
<T>,
37
public
virtual
T
38
{
40
protected
:
BaseSegmentationCamera
();
41
43
public
:
virtual
~BaseSegmentationCamera
();
44
45
// Documentation inherited
46
public
:
virtual
void
CreateSegmentationTexture
()
override
= 0;
47
48
// Documentation inherited
49
public
:
virtual
uint8_t *
SegmentationData
()
const override
;
50
51
// Documentation inherited
52
public
:
virtual
gz::common::ConnectionPtr
53
ConnectNewSegmentationFrame
(
54
std::function
<
void
(
const
uint8_t *,
unsigned
int
,
unsigned
int
,
55
unsigned
int
,
const
std::string
&)> _subscriber)
override
;
56
57
// Documentation inherited
58
public
:
virtual
void
SetSegmentationType
(
59
SegmentationType
_type)
override
;
60
61
// Documentation inherited
62
public
:
virtual
SegmentationType
Type
()
const override
;
63
64
// Documentation inherited
65
public
:
virtual
void
EnableColoredMap
(
bool
_enable)
override
;
66
67
// Documentation inherited
68
public
:
virtual
bool
IsColoredMap
()
const override
;
69
70
// Documentation inherited
71
public
:
virtual
void
SetBackgroundColor
(
72
const
math::Color
&_color)
override
;
73
74
// Documentation inherited
75
public
:
virtual
void
SetBackgroundLabel
(
int
_label)
override
;
76
77
// Documentation inherited
78
public
:
virtual
const
math::Color
&
BackgroundColor
()
const override
;
79
80
// Documentation inherited
81
public
:
virtual
int
BackgroundLabel
()
const override
;
82
83
// Documentation inherited
84
public
:
void
LabelMapFromColoredBuffer
(
85
uint8_t *_labelBuffer)
const override
= 0;
86
88
protected
: uint8_t *segmentationData {
nullptr
};
89
91
protected
:
SegmentationType
type {SegmentationType::ST_SEMANTIC};
92
95
protected
:
bool
isColoredMap {
false
};
96
99
protected
:
math::Color
backgroundColor {0, 0, 0};
100
102
protected
:
int
backgroundLabel {0};
103
};
104
106
template
<
class
T>
107
BaseSegmentationCamera<T>::BaseSegmentationCamera
()
108
{
109
}
110
112
template
<
class
T>
113
BaseSegmentationCamera<T>::~BaseSegmentationCamera
()
114
{
115
if
(this->segmentationData)
116
{
117
delete
[] this->segmentationData;
118
this->segmentationData =
nullptr
;
119
}
120
}
121
123
template
<
class
T>
124
uint8_t *
BaseSegmentationCamera<T>::SegmentationData
()
const
125
{
126
return
this->segmentationData;
127
}
128
130
template
<
class
T>
131
gz::common::ConnectionPtr
BaseSegmentationCamera<T>::
132
ConnectNewSegmentationFrame
(
133
std::function
<
void
(
const
uint8_t *,
unsigned
int
,
unsigned
int
,
134
unsigned
int
,
const
std::string
&)>)
135
{
136
return
nullptr
;
137
}
138
140
template
<
class
T>
141
void
BaseSegmentationCamera<T>::SetSegmentationType
(
SegmentationType
_type)
142
{
143
this->type = _type;
144
}
145
147
template
<
class
T>
148
void
BaseSegmentationCamera<T>::EnableColoredMap
(
bool
_enable)
149
{
150
this->isColoredMap = _enable;
151
}
152
154
template
<
class
T>
155
SegmentationType
BaseSegmentationCamera<T>::Type
()
const
156
{
157
return
this->type;
158
}
159
161
template
<
class
T>
162
bool
BaseSegmentationCamera<T>::IsColoredMap
()
const
163
{
164
return
this->isColoredMap;
165
}
166
168
template
<
class
T>
169
void
BaseSegmentationCamera<T>::SetBackgroundColor
(
170
const
math::Color
&_color)
171
{
172
this->backgroundColor = _color;
173
}
174
176
template
<
class
T>
177
void
BaseSegmentationCamera<T>::SetBackgroundLabel
(
int
_label)
178
{
179
this->backgroundLabel = _label;
180
}
181
183
template
<
class
T>
184
const
math::Color
&
BaseSegmentationCamera<T>::BackgroundColor
()
const
185
{
186
return
this->backgroundColor;
187
}
188
190
template
<
class
T>
191
int
BaseSegmentationCamera<T>::BackgroundLabel
()
const
192
{
193
return
this->backgroundLabel;
194
}
195
}
196
}
197
}
198
#endif