##

Distortion Class Reference
Rendering

Camera distortion based on the Brown-Conrady model. More...

`#include <rendering/rendering.hh>`

## Public Member Functions

| Distortion ()
| Constructor. More...
virtual | ~Distortion ()
| Destructor. More...
ignition::math::Vector2d | Center () const
| Get the distortion center. More...
bool | Crop () const
| Get whether or not the camera is being cropped to account for black borders created by barrel distortion. More...
double | K1 () const
| Get the radial distortion coefficient k1. More...
double | K2 () const
| Get the radial distortion coefficient k2. More...
double | K3 () const
| Get the radial distortion coefficient k3. More...
virtual void | Load (sdf::ElementPtr _sdf)
| Load the camera with a set of parmeters. More...
double | P1 () const
| Get the tangential distortion coefficient p1. More...
double | P2 () const
| Get the tangential distortion coefficient p2. More...
void | SetCamera (CameraPtr _camera)
| Set the camera which distortion will be applied to. More...
void | SetCrop (const bool _crop)
| Set whether to crop the black border around the distorted image points. More...

## Static Public Member Functions

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. More...

## Protected Member Functions

void | CalculateAndApplyDistortionScale ()
| calculate the correct scale factor to "zoom" the render, cutting off black borders caused by distortion (only if the crop flag has been set). More...
ignition::math::Vector2d | DistortionMapValueClamped (const int x, const int y) const
| get the distortion map value. More...

## Detailed Description

Camera distortion based on the Brown-Conrady model.

## Constructor & Destructor Documentation

## Distortion()

Distortion | ( |  | ) |

Constructor.

## ~Distortion()

virtual ~Distortion | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## CalculateAndApplyDistortionScale()

void CalculateAndApplyDistortionScale | ( |  | ) |

protected

calculate the correct scale factor to "zoom" the render, cutting off black borders caused by distortion (only if the crop flag has been set).

## Center()

ignition::math::Vector2d Center | ( |  | ) | const

Get the distortion center.

Returns
  Distortion center.

## Crop()

bool Crop | ( |  | ) | const

Get whether or not the camera is being cropped to account for black borders created by barrel distortion.

Returns
  True if the black border is cropped

See also
  SetCrop

## 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
| ) |  |

static

Apply distortion model.

Parameters

  [in] | _in | Input uv coordinate.
  [in] | _center | Normalized distortion center.
  [in] | _k1 | Radial distortion coefficient k1.
  [in] | _k2 | Radial distortion coefficient k2.
  [in] | _k3 | Radial distortion coefficient k3.
  [in] | _p1 | Tangential distortion coefficient p1.
  [in] | _p2 | Tangential distortion coefficient p2.

Returns
  Distorted coordinate.

## DistortionMapValueClamped()

ignition::math::Vector2d DistortionMapValueClamped | ( | const int | x,
|  | const int | y
| ) |  | const

protected

get the distortion map value.

Returns
  the distortion map value at the specified index, or (-1, -1) if the index is out of bounds.

## K1()

double K1 | ( |  | ) | const

Get the radial distortion coefficient k1.

Returns
  Distortion coefficient k1.

## K2()

double K2 | ( |  | ) | const

Get the radial distortion coefficient k2.

Returns
  Distortion coefficient k2.

## K3()

double K3 | ( |  | ) | const

Get the radial distortion coefficient k3.

Returns
  Distortion coefficient k3.

## Load()

virtual void Load | ( | sdf::ElementPtr | _sdf | ) |

virtual

Load the camera with a set of parmeters.

Parameters

  [in] | _sdf | The SDF camera info

## P1()

double P1 | ( |  | ) | const

Get the tangential distortion coefficient p1.

Returns
  Distortion coefficient p1.

## P2()

double P2 | ( |  | ) | const

Get the tangential distortion coefficient p2.

Returns
  Distortion coefficient p2.

## SetCamera()

void SetCamera | ( | CameraPtr | _camera | ) |

Set the camera which distortion will be applied to.

Parameters

  [in] | _camera | Camera to be distorted

## SetCrop()

void SetCrop | ( | const bool | _crop | ) |

Set whether to crop the black border around the distorted image points.

Parameters

  [in] | _crop | True to crop the black border

See also
  Crop

The documentation for this class was generated from the following file:

- Distortion.hh