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 
23 #include <sdf/Error.hh>
24 #include <sdf/Element.hh>
25 #include <sdf/Noise.hh>
26 #include <sdf/sdf_config.h>
27 
28 namespace sdf
29 {
30  // Inline bracket to help doxygen filtering.
31  inline namespace SDF_VERSION_NAMESPACE {
32  //
33  // Forward declare private data class.
34  class CameraPrivate;
35 
39  enum class PixelFormatType
40  {
42  L_INT8,
43  L_INT16,
44  RGB_INT8,
45  RGBA_INT8,
46  BGRA_INT8,
47  RGB_INT16,
48  RGB_INT32,
49  BGR_INT8,
50  BGR_INT16,
51  BGR_INT32,
52  R_FLOAT16,
54  R_FLOAT32,
60  };
61 
64  {
66  public: Camera();
67 
70  public: Camera(const Camera &_camera);
71 
74  public: Camera(Camera &&_camera) noexcept;
75 
77  public: virtual ~Camera();
78 
82  public: Camera &operator=(const Camera &_camera);
83 
87  public: Camera &operator=(Camera &&_camera) noexcept;
88 
92  public: bool operator==(const Camera &_alt) const;
93 
98  public: bool operator!=(const Camera &_alt) const;
99 
106  public: Errors Load(ElementPtr _sdf);
107 
110  public: std::string CameraInfoTopic() const;
111 
114  public: void SetCameraInfoTopic(const std::string& _cameraInfoTopic);
115 
120  public: sdf::ElementPtr Element() const;
121 
124  public: std::string Name() const;
125 
128  public: void SetName(const std::string &_name);
129 
132  public: gz::math::Angle HorizontalFov() const;
133 
136  public: void SetHorizontalFov(const gz::math::Angle &_hfov);
137 
140  public: uint32_t ImageWidth() const;
141 
144  public: void SetImageWidth(uint32_t _width);
145 
148  public: uint32_t ImageHeight() const;
149 
152  public: void SetImageHeight(uint32_t _height);
153 
157  public: PixelFormatType PixelFormat() const;
158 
161  public: void SetPixelFormat(PixelFormatType _format);
162 
165  public: std::string PixelFormatStr() const;
166 
169  public: void SetPixelFormatStr(const std::string &_fmt);
170 
173  public: uint32_t AntiAliasingValue() const;
174 
177  public: void SetAntiAliasingValue(uint32_t _antiAliasingValue);
178 
181  public: double DepthNearClip() const;
182 
185  public: void SetDepthNearClip(double _near);
186 
189  public: double DepthFarClip() const;
190 
193  public: void SetDepthFarClip(double _far);
194 
197  public: double NearClip() const;
198 
201  public: void SetNearClip(double _near);
202 
205  public: void SetHasDepthCamera(bool _camera);
206 
209  public: bool HasDepthCamera() const;
210 
215  public: void SetHasDepthNearClip(bool _near);
216 
219  public: bool HasDepthNearClip() const;
220 
225  public: void SetHasDepthFarClip(bool _far);
226 
229  public: bool HasDepthFarClip() const;
230 
233  public: double FarClip() const;
234 
237  public: void SetFarClip(double _far);
238 
241  public: bool SaveFrames() const;
242 
245  public: void SetSaveFrames(bool _save);
246 
249  public: const std::string &SaveFramesPath() const;
250 
253  public: void SetSaveFramesPath(const std::string &_path);
254 
257  public: const Noise &ImageNoise() const;
258 
261  public: void SetImageNoise(const Noise &_noise);
262 
265  public: double DistortionK1() const;
266 
269  public: void SetDistortionK1(double _k1);
270 
273  public: double DistortionK2() const;
274 
277  public: void SetDistortionK2(double _k2);
278 
281  public: double DistortionK3() const;
282 
285  public: void SetDistortionK3(double _k3);
286 
289  public: double DistortionP1() const;
290 
293  public: void SetDistortionP1(double _p1);
294 
297  public: double DistortionP2() const;
298 
301  public: void SetDistortionP2(double _p2);
302 
305  public: const gz::math::Vector2d &DistortionCenter() const;
306 
309  public: void SetDistortionCenter(
310  const gz::math::Vector2d &_center) const;
311 
316  public: const gz::math::Pose3d &Pose() const
317  SDF_DEPRECATED(9.0);
318 
323  public: void SetPose(const gz::math::Pose3d &_pose)
324  SDF_DEPRECATED(9.0);
325 
329  public: const gz::math::Pose3d &RawPose() const;
330 
334  public: void SetRawPose(const gz::math::Pose3d &_pose);
335 
340  public: const std::string &PoseRelativeTo() const;
341 
346  public: void SetPoseRelativeTo(const std::string &_frame);
347 
353  public: const std::string &PoseFrame() const
354  SDF_DEPRECATED(9.0);
355 
361  public: void SetPoseFrame(const std::string &_frame)
362  SDF_DEPRECATED(9.0);
363 
370  public: std::string LensType() const;
371 
375  public: void SetLensType(const std::string &_type);
376 
380  public: bool LensScaleToHfov() const;
381 
385  public: void SetLensScaleToHfov(bool _scale);
386 
389  public: double LensC1() const;
390 
393  public: void SetLensC1(double _c1);
394 
397  public: double LensC2() const;
398 
401  public: void SetLensC2(double _c2);
402 
405  public: double LensC3() const;
406 
409  public: void SetLensC3(double _c3);
410 
413  public: double LensFocalLength() const;
414 
417  public: void SetLensFocalLength(double _f);
418 
422  public: const std::string &LensFunction() const;
423 
427  public: void SetLensFunction(const std::string &_fun);
428 
432  public: gz::math::Angle LensCutoffAngle() const;
433 
437  public: void SetLensCutoffAngle(const gz::math::Angle &_angle);
438 
442  public: int LensEnvironmentTextureSize() const;
443 
447  public: void SetLensEnvironmentTextureSize(int _size);
448 
451  public: double LensIntrinsicsFx() const;
452 
455  public: void SetLensIntrinsicsFx(double _fx);
456 
459  public: double LensIntrinsicsFy() const;
460 
463  public: void SetLensIntrinsicsFy(double _fy);
464 
467  public: double LensIntrinsicsCx() const;
468 
471  public: void SetLensIntrinsicsCx(double _cx);
472 
475  public: double LensIntrinsicsCy() const;
476 
479  public: void SetLensIntrinsicsCy(double _cy);
480 
483  public: double LensProjectionFx() const;
484 
487  public: void SetLensProjectionFx(double _fx_p);
488 
491  public: double LensProjectionFy() const;
492 
495  public: void SetLensProjectionFy(double _fy_p);
496 
499  public: double LensProjectionCx() const;
500 
503  public: void SetLensProjectionCx(double _cx_p);
504 
507  public: double LensProjectionCy() const;
508 
511  public: void SetLensProjectionCy(double _cy_p);
512 
515  public: double LensProjectionTx() const;
516 
519  public: void SetLensProjectionTx(double _tx);
520 
523  public: double LensProjectionTy() const;
524 
527  public: void SetLensProjectionTy(double _ty);
528 
531  public: double LensIntrinsicsSkew() const;
532 
535  public: void SetLensIntrinsicsSkew(double _s);
536 
540  public: static PixelFormatType ConvertPixelFormat(
541  const std::string &_format);
542 
546  public: static std::string ConvertPixelFormat(PixelFormatType _type);
547 
550  public: uint32_t VisibilityMask() const;
551 
554  public: void SetVisibilityMask(uint32_t _mask);
555 
558  public: bool HasLensProjection() const;
559 
561  private: CameraPrivate *dataPtr = nullptr;
562  };
563  }
564 }
565 
566 #endif
Error.hh
sdf::v9::PixelFormatType::BAYER_RGGB8
@ BAYER_RGGB8
Noise.hh
sdf
namespace for Simulation Description Format parser
Definition: Actor.hh:32
sdf::v9::PixelFormatType::L_INT16
@ L_INT16
sdf::v9::PixelFormatType
PixelFormatType
Definition: Camera.hh:39
sdf::v9::PixelFormatType::BAYER_GBRG8
@ BAYER_GBRG8
sdf::v9::PixelFormatType::RGB_INT32
@ RGB_INT32
sdf::v9::Errors
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:89
sdf::v9::PixelFormatType::BAYER_BGGR8
@ BAYER_BGGR8
sdf::v9::PixelFormatType::L_INT8
@ L_INT8
sdf::v9::PixelFormatType::R_FLOAT16
@ R_FLOAT16
sdf::v9::PixelFormatType::BGR_INT8
@ BGR_INT8
SDFORMAT_VISIBLE
#define SDFORMAT_VISIBLE
Definition: system_util.hh:48
sdf::v9::PixelFormatType::RGB_FLOAT16
@ RGB_FLOAT16
sdf::v9::PixelFormatType::UNKNOWN_PIXEL_FORMAT
@ UNKNOWN_PIXEL_FORMAT
sdf::v9::Noise
The Noise class contains information about a noise model, such as a Gaussian distribution.
Definition: Noise.hh:49
sdf::v9::PixelFormatType::BAYER_GRBG8
@ BAYER_GRBG8
sdf::v9::SDF_DEPRECATED
class SDFORMAT_VISIBLE SDF_DEPRECATED(9.2) URDF2SDF
URDF to SDF converter.
Definition: parser_urdf.hh:40
sdf::v9::PixelFormatType::BGR_INT32
@ BGR_INT32
sdf::v9::Camera
Information about a monocular camera sensor.
Definition: Camera.hh:63
sdf::v9::PixelFormatType::R_FLOAT32
@ R_FLOAT32
sdf::v9::ElementPtr
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
sdf::v9::PixelFormatType::RGB_INT8
@ RGB_INT8
sdf::v9::Element
class SDFORMAT_VISIBLE Element
Definition: Element.hh:49
sdf::v9::PixelFormatType::BGR_INT16
@ BGR_INT16
sdf::v9::PixelFormatType::BGRA_INT8
@ BGRA_INT8
sdf::v9::PixelFormatType::RGBA_INT8
@ RGBA_INT8
Element.hh
sdf::v9::PixelFormatType::RGB_FLOAT32
@ RGB_FLOAT32
sdf::v9::PixelFormatType::RGB_INT16
@ RGB_INT16