Camera.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2019 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 SDF_CAMERA_HH_
18 #define SDF_CAMERA_HH_
19 
20 #include <string>
21 #include <ignition/math/Pose3.hh>
22 #include <ignition/utils/ImplPtr.hh>
23 
24 #include <sdf/Error.hh>
25 #include <sdf/Element.hh>
26 #include <sdf/Noise.hh>
27 #include <sdf/sdf_config.h>
28 
29 namespace sdf
30 {
31  // Inline bracket to help doxygen filtering.
32  inline namespace SDF_VERSION_NAMESPACE {
36  enum class PixelFormatType
37  {
39  L_INT8,
40  L_INT16,
41  RGB_INT8,
42  RGBA_INT8,
43  BGRA_INT8,
44  RGB_INT16,
45  RGB_INT32,
46  BGR_INT8,
47  BGR_INT16,
48  BGR_INT32,
49  R_FLOAT16,
51  R_FLOAT32,
57  };
58 
61  {
63  public: Camera();
64 
68  public: bool operator==(const Camera &_alt) const;
69 
74  public: bool operator!=(const Camera &_alt) const;
75 
82  public: Errors Load(ElementPtr _sdf);
83 
88  public: sdf::ElementPtr Element() const;
89 
92  public: std::string Name() const;
93 
96  public: void SetName(const std::string &_name);
97 
100  public: ignition::math::Angle HorizontalFov() const;
101 
104  public: void SetHorizontalFov(const ignition::math::Angle &_hfov);
105 
108  public: uint32_t ImageWidth() const;
109 
112  public: void SetImageWidth(uint32_t _width);
113 
116  public: uint32_t ImageHeight() const;
117 
120  public: void SetImageHeight(uint32_t _height);
121 
125  public: PixelFormatType PixelFormat() const;
126 
129  public: void SetPixelFormat(PixelFormatType _format);
130 
133  public: std::string PixelFormatStr() const;
134 
137  public: void SetPixelFormatStr(const std::string &_fmt);
138 
141  public: double DepthNearClip() const;
142 
145  public: void SetDepthNearClip(double _near);
146 
149  public: double DepthFarClip() const;
150 
153  public: void SetDepthFarClip(double _far);
154 
157  public: double NearClip() const;
158 
161  public: void SetNearClip(double _near);
162 
165  public: void SetHasDepthCamera(bool _camera);
166 
169  public: bool HasDepthCamera() const;
170 
175  public: void SetHasDepthNearClip(bool _near);
176 
179  public: bool HasDepthNearClip() const;
180 
185  public: void SetHasDepthFarClip(bool _far);
186 
189  public: bool HasDepthFarClip() const;
190 
193  public: double FarClip() const;
194 
197  public: void SetFarClip(double _far);
198 
201  public: bool SaveFrames() const;
202 
205  public: void SetSaveFrames(bool _save);
206 
209  public: const std::string &SaveFramesPath() const;
210 
213  public: void SetSaveFramesPath(const std::string &_path);
214 
217  public: const Noise &ImageNoise() const;
218 
221  public: void SetImageNoise(const Noise &_noise);
222 
225  public: double DistortionK1() const;
226 
229  public: void SetDistortionK1(double _k1);
230 
233  public: double DistortionK2() const;
234 
237  public: void SetDistortionK2(double _k2);
238 
241  public: double DistortionK3() const;
242 
245  public: void SetDistortionK3(double _k3);
246 
249  public: double DistortionP1() const;
250 
253  public: void SetDistortionP1(double _p1);
254 
257  public: double DistortionP2() const;
258 
261  public: void SetDistortionP2(double _p2);
262 
265  public: const ignition::math::Vector2d &DistortionCenter() const;
266 
269  public: void SetDistortionCenter(const ignition::math::Vector2d &_center);
270 
274  public: const ignition::math::Pose3d &RawPose() const;
275 
279  public: void SetRawPose(const ignition::math::Pose3d &_pose);
280 
285  public: const std::string &PoseRelativeTo() const;
286 
291  public: void SetPoseRelativeTo(const std::string &_frame);
292 
299  public: std::string LensType() const;
300 
304  public: void SetLensType(const std::string &_type);
305 
309  public: bool LensScaleToHfov() const;
310 
314  public: void SetLensScaleToHfov(bool _scale);
315 
318  public: double LensC1() const;
319 
322  public: void SetLensC1(double _c1);
323 
326  public: double LensC2() const;
327 
330  public: void SetLensC2(double _c2);
331 
334  public: double LensC3() const;
335 
338  public: void SetLensC3(double _c3);
339 
342  public: double LensFocalLength() const;
343 
346  public: void SetLensFocalLength(double _f);
347 
351  public: const std::string &LensFunction() const;
352 
356  public: void SetLensFunction(const std::string &_fun);
357 
361  public: ignition::math::Angle LensCutoffAngle() const;
362 
366  public: void SetLensCutoffAngle(const ignition::math::Angle &_angle);
367 
371  public: int LensEnvironmentTextureSize() const;
372 
376  public: void SetLensEnvironmentTextureSize(int _size);
377 
380  public: double LensIntrinsicsFx() const;
381 
384  public: void SetLensIntrinsicsFx(double _fx);
385 
388  public: double LensIntrinsicsFy() const;
389 
392  public: void SetLensIntrinsicsFy(double _fy);
393 
396  public: double LensIntrinsicsCx() const;
397 
400  public: void SetLensIntrinsicsCx(double _cx);
401 
404  public: double LensIntrinsicsCy() const;
405 
408  public: void SetLensIntrinsicsCy(double _cy);
409 
412  public: double LensIntrinsicsSkew() const;
413 
416  public: void SetLensIntrinsicsSkew(double _s);
417 
421  public: static PixelFormatType ConvertPixelFormat(
422  const std::string &_format);
423 
427  public: static std::string ConvertPixelFormat(PixelFormatType _type);
428 
431  public: uint32_t VisibilityMask() const;
432 
435  public: void SetVisibilityMask(uint32_t _mask);
436 
438  IGN_UTILS_IMPL_PTR(dataPtr)
439  };
440  }
441 }
442 
443 #endif
PixelFormatType
The set of pixel formats.
Definition: Camera.hh:36
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:98
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:41
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
Information about a monocular camera sensor.
Definition: Camera.hh:60
class SDFORMAT_VISIBLE Element
Definition: Element.hh:49
namespace for Simulation Description Format parser
Definition: Actor.hh:33
The Noise class contains information about a noise model, such as a Gaussian distribution.
Definition: Noise.hh:47