##

Distortion.hh
Go to the documentation of this file.
/*
* Copyright (C) 2014 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_RENDERING_DISTORTION_HH_
#define GAZEBO_RENDERING_DISTORTION_HH_
#include <memory>
#include <ignition/math/Vector2.hh>
#include <sdf/Element.hh>
#include "gazebo/rendering/RenderTypes.hh"
#include "gazebo/util/system.hh"
namespace gazebo
{
namespace rendering
{
class DistortionPrivate;
class GZ_RENDERING_VISIBLE Distortion
{
public: Distortion();
public: virtual ~Distortion();
public: virtual void Load(sdf::ElementPtr _sdf);
public: void SetCamera(CameraPtr _camera);
public: void SetCrop(const bool _crop);
public: bool Crop() const;
public: double K1() const;
public: double K2() const;
public: double K3() const;
public: double P1() const;
public: double P2() const;
public: ignition::math::Vector2d Center() const;
public: static ignition::math::Vector2d Distort(
const ignition::math::Vector2d &_in,
const ignition::math::Vector2d &_center,
double _k1, double _k2, double _k3,
double _p1, double _p2);
protected: ignition::math::Vector2d
DistortionMapValueClamped(const int x, const int y) const;
protected: void CalculateAndApplyDistortionScale();
private: std::unique_ptr<DistortionPrivate> dataPtr;
};
}
}
#endif
gazebo::rendering::Distortion::Distortion
Distortion()
Constructor.
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::rendering::Distortion::Center
ignition::math::Vector2d Center() const
Get the distortion center.
system.hh
gazebo::rendering::Distortion::P1
double P1() const
Get the tangential distortion coefficient p1.
gazebo::rendering::Distortion::K2
double K2() const
Get the radial distortion coefficient k2.
gazebo::rendering::Distortion::Crop
bool Crop() const
Get whether or not the camera is being cropped to account for black borders created by barrel distort...
gazebo::rendering::Distortion::~Distortion
virtual ~Distortion()
Destructor.
gazebo::rendering::Distortion
Camera distortion based on the Brown-Conrady model.
Definition: Distortion.hh:40
RenderTypes.hh
rendering
rendering
Definition: RenderEngine.hh:31
gazebo::rendering::Distortion::K1
double K1() const
Get the radial distortion coefficient k1.
gazebo::rendering::Distortion::CalculateAndApplyDistortionScale
void CalculateAndApplyDistortionScale()
calculate the correct scale factor to "zoom" the render, cutting off black borders caused by distorti...
gazebo::rendering::Distortion::DistortionMapValueClamped
ignition::math::Vector2d DistortionMapValueClamped(const int x, const int y) const
get the distortion map value.
gazebo::rendering::Distortion::Distort
static ignition::math::Vector2d Distort(const ignition::math::Vector2d &_in, const ignition::math::Vector2d &_center, double _k1, double _k2, double _k3, double _p1, double _p2)
Apply distortion model.
gazebo::rendering::Distortion::SetCamera
void SetCamera(CameraPtr _camera)
Set the camera which distortion will be applied to.
gazebo::rendering::CameraPtr
boost::shared_ptr< Camera > CameraPtr
Definition: RenderTypes.hh:90
gazebo::rendering::Distortion::Load
virtual void Load(sdf::ElementPtr _sdf)
Load the camera with a set of parmeters.
gazebo::rendering::Distortion::K3
double K3() const
Get the radial distortion coefficient k3.
gazebo::rendering::Distortion::P2
double P2() const
Get the tangential distortion coefficient p2.
gazebo::rendering::Distortion::SetCrop
void SetCrop(const bool _crop)
Set whether to crop the black border around the distorted image points.