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 
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 
112  public: sdf::ElementPtr Element() const;
113 
116  public: std::string Name() const;
117 
120  public: void SetName(const std::string &_name);
121 
124  public: ignition::math::Angle HorizontalFov() const;
125 
128  public: void SetHorizontalFov(const ignition::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: double NearClip() const;
166 
169  public: void SetNearClip(double _near);
170 
173  public: double FarClip() const;
174 
177  public: void SetFarClip(double _far);
178 
181  public: bool SaveFrames() const;
182 
185  public: void SetSaveFrames(bool _save);
186 
189  public: const std::string &SaveFramesPath() const;
190 
193  public: void SetSaveFramesPath(const std::string &_path);
194 
197  public: const Noise &ImageNoise() const;
198 
201  public: void SetImageNoise(const Noise &_noise);
202 
205  public: double DistortionK1() const;
206 
209  public: void SetDistortionK1(double _k1);
210 
213  public: double DistortionK2() const;
214 
217  public: void SetDistortionK2(double _k2);
218 
221  public: double DistortionK3() const;
222 
225  public: void SetDistortionK3(double _k3);
226 
229  public: double DistortionP1() const;
230 
233  public: void SetDistortionP1(double _p1);
234 
237  public: double DistortionP2() const;
238 
241  public: void SetDistortionP2(double _p2);
242 
245  public: const ignition::math::Vector2d &DistortionCenter() const;
246 
249  public: void SetDistortionCenter(
250  const ignition::math::Vector2d &_center) const;
251 
256  public: const ignition::math::Pose3d &Pose() const
257  SDF_DEPRECATED(9.0);
258 
263  public: void SetPose(const ignition::math::Pose3d &_pose)
264  SDF_DEPRECATED(9.0);
265 
269  public: const ignition::math::Pose3d &RawPose() const;
270 
274  public: void SetRawPose(const ignition::math::Pose3d &_pose);
275 
280  public: const std::string &PoseRelativeTo() const;
281 
286  public: void SetPoseRelativeTo(const std::string &_frame);
287 
293  public: const std::string &PoseFrame() const
294  SDF_DEPRECATED(9.0);
295 
301  public: void SetPoseFrame(const std::string &_frame)
302  SDF_DEPRECATED(9.0);
303 
310  public: std::string LensType() const;
311 
315  public: void SetLensType(const std::string &_type);
316 
320  public: bool LensScaleToHfov() const;
321 
325  public: void SetLensScaleToHfov(bool _scale);
326 
329  public: double LensC1() const;
330 
333  public: void SetLensC1(double _c1);
334 
337  public: double LensC2() const;
338 
341  public: void SetLensC2(double _c2);
342 
345  public: double LensC3() const;
346 
349  public: void SetLensC3(double _c3);
350 
353  public: double LensFocalLength() const;
354 
357  public: void SetLensFocalLength(double _f);
358 
362  public: const std::string &LensFunction() const;
363 
367  public: void SetLensFunction(const std::string &_fun);
368 
372  public: ignition::math::Angle LensCutoffAngle() const;
373 
377  public: void SetLensCutoffAngle(const ignition::math::Angle &_angle);
378 
382  public: int LensEnvironmentTextureSize() const;
383 
387  public: void SetLensEnvironmentTextureSize(int _size);
388 
391  public: double LensIntrinsicsFx() const;
392 
395  public: void SetLensIntrinsicsFx(double _fx);
396 
399  public: double LensIntrinsicsFy() const;
400 
403  public: void SetLensIntrinsicsFy(double _fy);
404 
407  public: double LensIntrinsicsCx() const;
408 
411  public: void SetLensIntrinsicsCx(double _cx);
412 
415  public: double LensIntrinsicsCy() const;
416 
419  public: void SetLensIntrinsicsCy(double _cy);
420 
423  public: double LensIntrinsicsSkew() const;
424 
427  public: void SetLensIntrinsicsSkew(double _s);
428 
432  public: static PixelFormatType ConvertPixelFormat(
433  const std::string &_format);
434 
438  public: static std::string ConvertPixelFormat(PixelFormatType _type);
439 
440 
442  private: CameraPrivate *dataPtr;
443  };
444  }
445 }
446 
447 #endif
class SDFORMAT_VISIBLE Element
Definition: Element.hh:49
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
The Noise class contains information about a noise model, such as a Gaussian distribution.
Definition: Noise.hh:49
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:74
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:48
PixelFormatType
The set of pixel formats.
Definition: Camera.hh:39
Information about a monocular camera sensor.
Definition: Camera.hh:63
namespace for Simulation Description Format parser
Definition: Actor.hh:32
#define SDF_DEPRECATED(version)
Definition: Types.hh:38