Distortion.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 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 
18 #ifndef _GAZEBO_RENDERING_DISTORTION_HH_
19 #define _GAZEBO_RENDERING_DISTORTION_HH_
20 
21 #include <sdf/sdf.hh>
22 #include <ignition/math.hh>
24 #include "gazebo/util/system.hh"
25 
26 namespace gazebo
27 {
30  namespace rendering
31  {
32  class DistortionPrivate;
33 
36 
39  class GZ_RENDERING_VISIBLE Distortion
40  {
42  public: Distortion();
43 
45  public: virtual ~Distortion();
46 
49  public: virtual void Load(sdf::ElementPtr _sdf);
50 
53  public: void SetCamera(CameraPtr _camera);
54 
58  public: void SetCrop(bool _crop);
59 
62  public: double GetK1() const;
63 
66  public: double GetK2() const;
67 
70  public: double GetK3() const;
71 
74  public: double GetP1() const;
75 
78  public: double GetP2() const;
79 
83  public: bool Crop() const;
84 
87  public: math::Vector2d GetCenter() const;
88 
98  public: static math::Vector2d Distort(
99  const math::Vector2d &_in,
100  const math::Vector2d &_center, double _k1, double _k2,
101  double _k3, double _p1, double _p2);
102 
107  protected: ignition::math::Vector2d
108  DistortionMapValueClamped(const int x, const int y) const;
109 
113  protected: void CalculateAndApplyDistortionScale();
114 
116  protected: sdf::ElementPtr sdf;
117 
120  private: DistortionPrivate *dataPtr;
121  };
123  }
124 }
125 #endif
Forward declarations for the common classes.
Definition: Animation.hh:33
Generic double x, y vector.
Definition: Vector2d.hh:36
Camera distortion based on the Brown-Conrady model.
Definition: Distortion.hh:39
boost::shared_ptr< Camera > CameraPtr
Definition: RenderTypes.hh:88
sdf::ElementPtr sdf
Distortion SDF values.
Definition: Distortion.hh:116