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 <gz/math/Pose3.hh>
22 #include <gz/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 
86  public: std::string CameraInfoTopic() const;
87 
90  public: void SetCameraInfoTopic(const std::string& _cameraInfoTopic);
91 
96  public: sdf::ElementPtr Element() const;
97 
100  public: std::string Name() const;
101 
104  public: void SetName(const std::string &_name);
105 
108  public: bool Triggered() const;
109 
112  public: void SetTriggered(bool _triggered);
113 
116  public: std::string TriggerTopic() const;
117 
120  public: void SetTriggerTopic(const std::string &_triggerTopic);
121 
124  public: gz::math::Angle HorizontalFov() const;
125 
128  public: void SetHorizontalFov(const gz::math::Angle &_hfov);
129 
132  public: uint32_t ImageWidth() const;
133 
136  public: void SetImageWidth(uint32_t _width);
137 
140  public: uint32_t ImageHeight() const;
141 
144  public: void SetImageHeight(uint32_t _height);
145 
149  public: PixelFormatType PixelFormat() const;
150 
153  public: void SetPixelFormat(PixelFormatType _format);
154 
157  public: std::string PixelFormatStr() const;
158 
161  public: void SetPixelFormatStr(const std::string &_fmt);
162 
165  public: uint32_t AntiAliasingValue() const;
166 
169  public: void SetAntiAliasingValue(uint32_t _antiAliasingValue);
170 
173  public: double DepthNearClip() const;
174 
177  public: void SetDepthNearClip(double _near);
178 
181  public: double DepthFarClip() const;
182 
185  public: void SetDepthFarClip(double _far);
186 
189  public: double NearClip() const;
190 
193  public: void SetNearClip(double _near);
194 
197  public: void SetHasDepthCamera(bool _camera);
198 
201  public: bool HasDepthCamera() const;
202 
207  public: void SetHasDepthNearClip(bool _near);
208 
211  public: bool HasDepthNearClip() const;
212 
217  public: void SetHasDepthFarClip(bool _far);
218 
221  public: bool HasDepthFarClip() const;
222 
225  public: double FarClip() const;
226 
229  public: void SetFarClip(double _far);
230 
234  public: void SetHasSegmentationType(bool _type);
235 
238  public: bool HasSegmentationType() const;
239 
242  public: const std::string &SegmentationType() const;
243 
246  public: void SetSegmentationType(const std::string &_type);
247 
251  public: void SetHasBoundingBoxType(bool _type);
252 
255  public: bool HasBoundingBoxType() const;
256 
259  public: const std::string &BoundingBoxType() const;
260 
263  public: void SetBoundingBoxType(const std::string &_type);
264 
267  public: bool SaveFrames() const;
268 
271  public: void SetSaveFrames(bool _save);
272 
275  public: const std::string &SaveFramesPath() const;
276 
279  public: void SetSaveFramesPath(const std::string &_path);
280 
283  public: const Noise &ImageNoise() const;
284 
287  public: void SetImageNoise(const Noise &_noise);
288 
291  public: double DistortionK1() const;
292 
295  public: void SetDistortionK1(double _k1);
296 
299  public: double DistortionK2() const;
300 
303  public: void SetDistortionK2(double _k2);
304 
307  public: double DistortionK3() const;
308 
311  public: void SetDistortionK3(double _k3);
312 
315  public: double DistortionP1() const;
316 
319  public: void SetDistortionP1(double _p1);
320 
323  public: double DistortionP2() const;
324 
327  public: void SetDistortionP2(double _p2);
328 
331  public: const gz::math::Vector2d &DistortionCenter() const;
332 
335  public: void SetDistortionCenter(const gz::math::Vector2d &_center);
336 
340  public: const gz::math::Pose3d &RawPose() const;
341 
345  public: void SetRawPose(const gz::math::Pose3d &_pose);
346 
351  public: const std::string &PoseRelativeTo() const;
352 
357  public: void SetPoseRelativeTo(const std::string &_frame);
358 
366  public: const std::string OpticalFrameId() const;
367 
371  public: void SetOpticalFrameId(const std::string &_frame);
372 
379  public: std::string LensType() const;
380 
384  public: void SetLensType(const std::string &_type);
385 
389  public: bool LensScaleToHfov() const;
390 
394  public: void SetLensScaleToHfov(bool _scale);
395 
398  public: double LensC1() const;
399 
402  public: void SetLensC1(double _c1);
403 
406  public: double LensC2() const;
407 
410  public: void SetLensC2(double _c2);
411 
414  public: double LensC3() const;
415 
418  public: void SetLensC3(double _c3);
419 
422  public: double LensFocalLength() const;
423 
426  public: void SetLensFocalLength(double _f);
427 
431  public: const std::string &LensFunction() const;
432 
436  public: void SetLensFunction(const std::string &_fun);
437 
441  public: gz::math::Angle LensCutoffAngle() const;
442 
446  public: void SetLensCutoffAngle(const gz::math::Angle &_angle);
447 
451  public: int LensEnvironmentTextureSize() const;
452 
456  public: void SetLensEnvironmentTextureSize(int _size);
457 
460  public: double LensIntrinsicsFx() const;
461 
464  public: void SetLensIntrinsicsFx(double _fx);
465 
468  public: double LensIntrinsicsFy() const;
469 
472  public: void SetLensIntrinsicsFy(double _fy);
473 
476  public: double LensIntrinsicsCx() const;
477 
480  public: void SetLensIntrinsicsCx(double _cx);
481 
484  public: double LensIntrinsicsCy() const;
485 
488  public: void SetLensIntrinsicsCy(double _cy);
489 
492  public: double LensProjectionFx() const;
493 
496  public: void SetLensProjectionFx(double _fx_p);
497 
500  public: double LensProjectionFy() const;
501 
504  public: void SetLensProjectionFy(double _fy_p);
505 
508  public: double LensProjectionCx() const;
509 
512  public: void SetLensProjectionCx(double _cx_p);
513 
516  public: double LensProjectionCy() const;
517 
520  public: void SetLensProjectionCy(double _cy_p);
521 
524  public: double LensProjectionTx() const;
525 
528  public: void SetLensProjectionTx(double _tx);
529 
532  public: double LensProjectionTy() const;
533 
536  public: void SetLensProjectionTy(double _ty);
537 
540  public: double LensIntrinsicsSkew() const;
541 
544  public: void SetLensIntrinsicsSkew(double _s);
545 
549  public: static PixelFormatType ConvertPixelFormat(
550  const std::string &_format);
551 
555  public: static std::string ConvertPixelFormat(PixelFormatType _type);
556 
559  public: uint32_t VisibilityMask() const;
560 
563  public: void SetVisibilityMask(uint32_t _mask);
564 
567  public: bool HasLensIntrinsics() const;
568 
571  public: bool HasLensProjection() const;
572 
578  public: sdf::ElementPtr ToElement() const;
579 
581  GZ_UTILS_IMPL_PTR(dataPtr)
582  };
583  }
584 }
585 
586 #endif
sdf::SDF_VERSION_NAMESPACE::PixelFormatType::R_FLOAT32
@ R_FLOAT32
sdf::SDF_VERSION_NAMESPACE::PixelFormatType::BGR_INT8
@ BGR_INT8
sdf::SDF_VERSION_NAMESPACE::Camera
Information about a monocular camera sensor.
Definition: Camera.hh:60
Error.hh
sdf::SDF_VERSION_NAMESPACE::PixelFormatType::R_FLOAT16
@ R_FLOAT16
sdf::SDF_VERSION_NAMESPACE::PixelFormatType::BAYER_BGGR8
@ BAYER_BGGR8
Noise.hh
sdf
namespace for Simulation Description Format parser
Definition: Actor.hh:34
sdf::SDF_VERSION_NAMESPACE::PixelFormatType::L_INT8
@ L_INT8
sdf::SDF_VERSION_NAMESPACE::PixelFormatType::L_INT16
@ L_INT16
sdf::SDF_VERSION_NAMESPACE::PixelFormatType::BGR_INT32
@ BGR_INT32
sdf::SDF_VERSION_NAMESPACE::PixelFormatType::RGB_FLOAT16
@ RGB_FLOAT16
sdf::SDF_VERSION_NAMESPACE::PixelFormatType::RGBA_INT8
@ RGBA_INT8
sdf_config.h
SDFORMAT_VISIBLE
#define SDFORMAT_VISIBLE
Definition: system_util.hh:25
sdf::SDF_VERSION_NAMESPACE::PixelFormatType::BAYER_GRBG8
@ BAYER_GRBG8
sdf::SDF_VERSION_NAMESPACE::PixelFormatType
PixelFormatType
Definition: Camera.hh:36
sdf::SDF_VERSION_NAMESPACE::PixelFormatType::RGB_INT8
@ RGB_INT8
sdf::SDF_VERSION_NAMESPACE::PixelFormatType::UNKNOWN_PIXEL_FORMAT
@ UNKNOWN_PIXEL_FORMAT
sdf::SDF_VERSION_NAMESPACE::PixelFormatType::RGB_INT16
@ RGB_INT16
sdf::SDF_VERSION_NAMESPACE::PixelFormatType::BGR_INT16
@ BGR_INT16
sdf::SDF_VERSION_NAMESPACE::Noise
The Noise class contains information about a noise model, such as a Gaussian distribution.
Definition: Noise.hh:47
sdf::SDF_VERSION_NAMESPACE::PixelFormatType::BAYER_RGGB8
@ BAYER_RGGB8
sdf::SDF_VERSION_NAMESPACE::PixelFormatType::RGB_INT32
@ RGB_INT32
sdf::SDF_VERSION_NAMESPACE::Element
class GZ_SDFORMAT_VISIBLE Element
Definition: Element.hh:51
sdf::SDF_VERSION_NAMESPACE::Errors
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:80
sdf::SDF_VERSION_NAMESPACE::PixelFormatType::BAYER_GBRG8
@ BAYER_GBRG8
sdf::SDF_VERSION_NAMESPACE::PixelFormatType::BGRA_INT8
@ BGRA_INT8
sdf::SDF_VERSION_NAMESPACE::PixelFormatType::RGB_FLOAT32
@ RGB_FLOAT32
sdf::SDF_VERSION_NAMESPACE::ElementPtr
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:55
Element.hh