base
Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | List of all members
base::samples::DepthMap Struct Reference

#include <DepthMap.hpp>

Public Types

enum  DEPTH_MEASUREMENT_STATE { VALID_MEASUREMENT = 0, TOO_FAR = 1, TOO_NEAR = 2, MEASUREMENT_ERROR = 3 }
 
enum  PROJECTION_TYPE { POLAR, PLANAR }
 
enum  UNIT_AXIS { UNIT_X = 0, UNIT_Y = 1, UNIT_Z = 2 }
 
typedef float scalar
 
typedef boost::uint32_t uint32_t
 
typedef Eigen::Matrix< scalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::DontAlign|Eigen::RowMajor > DepthMatrix
 
typedef const Eigen::Matrix< scalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::DontAlign|Eigen::RowMajor > DepthMatrixConst
 
typedef Eigen::Map< DepthMatrixDepthMatrixMap
 
typedef const Eigen::Map< DepthMatrixConstDepthMatrixMapConst
 

Public Member Functions

 DepthMap ()
 
void reset ()
 
DepthMatrixMap getDistanceMatrixMap ()
 
DepthMatrixMapConst getDistanceMatrixMapConst () const
 
DEPTH_MEASUREMENT_STATE getIndexState (size_t index) const
 
DEPTH_MEASUREMENT_STATE getMeasurementState (uint32_t v_index, uint32_t h_index) const
 
DEPTH_MEASUREMENT_STATE getMeasurementState (scalar distance) const
 
bool isIndexValid (size_t index) const
 
bool isMeasurementValid (uint32_t v_index, uint32_t h_index) const
 
bool isMeasurementValid (scalar distance) const
 
size_t getIndex (uint32_t v_index, uint32_t h_index) const
 
template<typename T >
void convertDepthMapToPointCloud (std::vector< T > &point_cloud, bool use_lut=false, bool skip_invalid_measurements=true) const
 
template<typename T >
void convertDepthMapToPointCloud (std::vector< T > &point_cloud, const Eigen::Transform< typename T::Scalar, 3, Eigen::Affine > &transformation, bool use_lut=false, bool skip_invalid_measurements=true) const
 
template<typename T >
void convertDepthMapToPointCloud (std::vector< T > &point_cloud, const Eigen::Transform< typename T::Scalar, 3, Eigen::Affine > &first_transformation, const Eigen::Transform< typename T::Scalar, 3, Eigen::Affine > &last_transformation, bool use_lut=false, bool skip_invalid_measurements=true, bool apply_transforms_vertically=true) const
 
template<typename T >
void convertDepthMapToPointCloud (std::vector< T > &point_cloud, const std::vector< Eigen::Transform< typename T::Scalar, 3, Eigen::Affine >, Eigen::aligned_allocator< Eigen::Transform< typename T::Scalar, 3, Eigen::Affine > > > &transformations, bool use_lut=false, bool skip_invalid_measurements=true, bool apply_transforms_vertically=true) const
 

Public Attributes

base::Time time
 
std::vector< base::Timetimestamps
 
PROJECTION_TYPE vertical_projection
 
PROJECTION_TYPE horizontal_projection
 
std::vector< double > vertical_interval
 
std::vector< double > horizontal_interval
 
uint32_t vertical_size
 
uint32_t horizontal_size
 
std::vector< scalardistances
 
std::vector< scalarremissions
 

Protected Member Functions

template<typename T >
void convertSingleRow (std::vector< T > &point_cloud, unsigned int row, const Eigen::Transform< typename T::Scalar, 3, Eigen::Affine > &row2column, const std::vector< Eigen::Transform< typename T::Scalar, 3, Eigen::Affine >, Eigen::aligned_allocator< Eigen::Transform< typename T::Scalar, 3, Eigen::Affine > > > &columns2pointcloud, const Eigen::Transform< typename T::Scalar, 3, Eigen::Affine > &pointcloud2world, bool skip_invalid_measurements) const
 
template<typename T >
void computeLocalTransformations (std::vector< Eigen::Transform< T, 3, Eigen::Affine >, Eigen::aligned_allocator< Eigen::Transform< T, 3, Eigen::Affine > > > &rows2column, std::vector< Eigen::Transform< T, 3, Eigen::Affine >, Eigen::aligned_allocator< Eigen::Transform< T, 3, Eigen::Affine > > > &columns2pointcloud, bool use_lut=false) const
 
template<typename T >
void computeRotations (std::vector< Eigen::Transform< T, 3, Eigen::Affine >, Eigen::aligned_allocator< Eigen::Transform< T, 3, Eigen::Affine > > > &rotations, const std::vector< base::Angle > &angles, UNIT_AXIS axis, bool use_lut=false) const
 
double computeResolution (const std::vector< double > &interval, uint32_t elements, PROJECTION_TYPE projection) const
 
bool checkSizeConfig () const
 

Detailed Description

The DepthMap type provides distance and optional remission values in 3D. The information is stored in a vector in a row major form, to simplify the usage as a distance image. One row is a set of horizontal arranged single measurements with an identical vertical position or angle. The distance and remission fields can therefore be seen as a image plane or a matrix. The horizontal and vertical intervals can be in polar or in planar form. In polar they are interpreted as angles and in planar form they are interpreted as coordinates on a depth-image plane. Horizontal intervals are always defined from left to right and vertical intervals are always defined top down. Each field of intervals can either have two entries, which define a range of regular arranged measurements, or one entry per measurement to represent the irregular case.

Member Typedef Documentation

◆ DepthMatrix

typedef Eigen::Matrix<scalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::DontAlign | Eigen::RowMajor> base::samples::DepthMap::DepthMatrix

◆ DepthMatrixConst

typedef const Eigen::Matrix<scalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::DontAlign | Eigen::RowMajor> base::samples::DepthMap::DepthMatrixConst

◆ DepthMatrixMap

◆ DepthMatrixMapConst

◆ scalar

◆ uint32_t

typedef boost::uint32_t base::samples::DepthMap::uint32_t

Member Enumeration Documentation

◆ DEPTH_MEASUREMENT_STATE

Enumerator
VALID_MEASUREMENT 
TOO_FAR 
TOO_NEAR 
MEASUREMENT_ERROR 

◆ PROJECTION_TYPE

Enumerator
POLAR 
PLANAR 

◆ UNIT_AXIS

Enumerator
UNIT_X 
UNIT_Y 
UNIT_Z 

Constructor & Destructor Documentation

◆ DepthMap()

base::samples::DepthMap::DepthMap ( )
inline

Member Function Documentation

◆ checkSizeConfig()

bool base::samples::DepthMap::checkSizeConfig ( ) const
protected

Checks if the vertical and horizontal sizes match the size of distance vector.

◆ computeLocalTransformations()

template<typename T >
void base::samples::DepthMap::computeLocalTransformations ( std::vector< Eigen::Transform< T, 3, Eigen::Affine >, Eigen::aligned_allocator< Eigen::Transform< T, 3, Eigen::Affine > > > &  rows2column,
std::vector< Eigen::Transform< T, 3, Eigen::Affine >, Eigen::aligned_allocator< Eigen::Transform< T, 3, Eigen::Affine > > > &  columns2pointcloud,
bool  use_lut = false 
) const
inlineprotected

Helper method to compute the local rows2column and columns2pointcloud transformations.

◆ computeResolution()

double base::samples::DepthMap::computeResolution ( const std::vector< double > &  interval,
uint32_t  elements,
PROJECTION_TYPE  projection 
) const
inlineprotected

Computes the resolution in a given interval.

◆ computeRotations()

template<typename T >
void base::samples::DepthMap::computeRotations ( std::vector< Eigen::Transform< T, 3, Eigen::Affine >, Eigen::aligned_allocator< Eigen::Transform< T, 3, Eigen::Affine > > > &  rotations,
const std::vector< base::Angle > &  angles,
UNIT_AXIS  axis,
bool  use_lut = false 
) const
inlineprotected

Helper method to compute the rotations around an unit axis.

◆ convertDepthMapToPointCloud() [1/4]

template<typename T >
void base::samples::DepthMap::convertDepthMapToPointCloud ( std::vector< T > &  point_cloud,
bool  use_lut = false,
bool  skip_invalid_measurements = true 
) const
inline

Converts the depth map to a pointcloud in the coordinate system of the sensor (x-axis = forward, y-axis = to the left, z-axis = upwards). If the resulting pointcloud should be associated with the remission values the invalid measurements should not be skipped. The template point type must be derived from a 3D eigen vector.

Parameters
point_cloudreturned pointcloud
use_luttrue, if lookup table for single unit axis rotations shall be used
skip_invalid_measurementstrue, if invalid measurements should be skipped

◆ convertDepthMapToPointCloud() [2/4]

template<typename T >
void base::samples::DepthMap::convertDepthMapToPointCloud ( std::vector< T > &  point_cloud,
const Eigen::Transform< typename T::Scalar, 3, Eigen::Affine > &  transformation,
bool  use_lut = false,
bool  skip_invalid_measurements = true 
) const
inline

Converts the depth map to a pointcloud according to the given transformation matrix. If the transformation matrix is set to identity the depth map is converted into the coordinate system of the sensor (x-axis = forward, y-axis = to the left, z-axis = upwards). If the resulting pointcloud should be associated with the remission values the invalid measurements should not be skipped. The template point type must be derived from a 3D eigen vector.

Parameters
point_cloudreturned pointcloud
transformationall points will be transformed using this transformation
use_luttrue, if lookup table for single unit axis rotations shall be used
skip_invalid_measurementstrue, if invalid measurements should be skipped

◆ convertDepthMapToPointCloud() [3/4]

template<typename T >
void base::samples::DepthMap::convertDepthMapToPointCloud ( std::vector< T > &  point_cloud,
const Eigen::Transform< typename T::Scalar, 3, Eigen::Affine > &  first_transformation,
const Eigen::Transform< typename T::Scalar, 3, Eigen::Affine > &  last_transformation,
bool  use_lut = false,
bool  skip_invalid_measurements = true,
bool  apply_transforms_vertically = true 
) const
inline

Converts the depth map to a pointcloud according to the given transformation matrices. On basis of the first and last transformation the transformations will be interpolated and applied row-wise if the parameter apply_transforms_vertically is set to true, otherwise they will be interpolated and applied col-wise.

Parameters
point_cloudreturned pointcloud
first_transformationtransformation of the first row or column
last_transformationtranslation of the last row or column
use_luttrue, if lookup table for single unit axis rotations shall be used
skip_invalid_measurementstrue, if invalid measurements should be skipped
apply_transforms_verticallytrue, if transformations should be applied row-wise

◆ convertDepthMapToPointCloud() [4/4]

template<typename T >
void base::samples::DepthMap::convertDepthMapToPointCloud ( std::vector< T > &  point_cloud,
const std::vector< Eigen::Transform< typename T::Scalar, 3, Eigen::Affine >, Eigen::aligned_allocator< Eigen::Transform< typename T::Scalar, 3, Eigen::Affine > > > &  transformations,
bool  use_lut = false,
bool  skip_invalid_measurements = true,
bool  apply_transforms_vertically = true 
) const
inline

Converts the depth map to a pointcloud according to the given transformation matrices. Each transformation in the given vector will be applied to each row if the parameter apply_transforms_vertically is set to true, otherwise it will be applied col-wise. The transformations vector therefore must have either the same size of the columns or the rows.

Parameters
point_cloudreturned pointcloud
transformationsvector of transformation matrices
use_luttrue, if lookup table for single unit axis rotations shall be used
skip_invalid_measurementstrue, if invalid measurements should be skipped
apply_transforms_verticallytrue, if transformations should be applied row-wise

◆ convertSingleRow()

template<typename T >
void base::samples::DepthMap::convertSingleRow ( std::vector< T > &  point_cloud,
unsigned int  row,
const Eigen::Transform< typename T::Scalar, 3, Eigen::Affine > &  row2column,
const std::vector< Eigen::Transform< typename T::Scalar, 3, Eigen::Affine >, Eigen::aligned_allocator< Eigen::Transform< typename T::Scalar, 3, Eigen::Affine > > > &  columns2pointcloud,
const Eigen::Transform< typename T::Scalar, 3, Eigen::Affine > &  pointcloud2world,
bool  skip_invalid_measurements 
) const
inlineprotected

Helper method which converts a single row to a pointcloud.

◆ getDistanceMatrixMap()

DepthMap::DepthMatrixMap base::samples::DepthMap::getDistanceMatrixMap ( )

Creates a mapping to a eigen matrix with dynamic sizes

◆ getDistanceMatrixMapConst()

DepthMap::DepthMatrixMapConst base::samples::DepthMap::getDistanceMatrixMapConst ( ) const

Creates a mapping to a const eigen matrix with dynamic sizes

◆ getIndex()

std::size_t base::samples::DepthMap::getIndex ( DepthMap::uint32_t  v_index,
DepthMap::uint32_t  h_index 
) const

Computes the index in the distance and remission vector of a given vertical and horizontal index. Note that the data is stored in row major form.

◆ getIndexState()

DepthMap::DEPTH_MEASUREMENT_STATE base::samples::DepthMap::getIndexState ( size_t  index) const

Returns the measurement state of a given index.

Parameters
indexof the measurement

◆ getMeasurementState() [1/2]

DepthMap::DEPTH_MEASUREMENT_STATE base::samples::DepthMap::getMeasurementState ( DepthMap::uint32_t  v_index,
DepthMap::uint32_t  h_index 
) const

Returns the measurement state of a given vertical and horizontal index.

Parameters
v_index
h_index

◆ getMeasurementState() [2/2]

DepthMap::DEPTH_MEASUREMENT_STATE base::samples::DepthMap::getMeasurementState ( DepthMap::scalar  distance) const

Returns the measurement state of a given measurement

Parameters
distancemeasurement

◆ isIndexValid()

bool base::samples::DepthMap::isIndexValid ( size_t  index) const

Returns true if the measurement at the given index is valid.

Parameters
indexof the measurement

◆ isMeasurementValid() [1/2]

bool base::samples::DepthMap::isMeasurementValid ( DepthMap::uint32_t  v_index,
DepthMap::uint32_t  h_index 
) const

Returns true if the measurement at the given vertical and horizontal index is valid.

Parameters
v_index
h_index

◆ isMeasurementValid() [2/2]

bool base::samples::DepthMap::isMeasurementValid ( DepthMap::scalar  distance) const

Returns true if the measurement is valid.

Parameters
distancemeasurement

◆ reset()

void base::samples::DepthMap::reset ( )

Reset the sample

Member Data Documentation

◆ distances

std::vector<scalar> base::samples::DepthMap::distances

The distance samples. The data is arranged in a row major order to simplify the usage as a distance image. One row is a set of horizontal arranged single measurements. The data for a measurement (vertical_index, horizontal_index) is in distances[(vertical_index * horizontal_size) + horizontal_index].

◆ horizontal_interval

std::vector<double> base::samples::DepthMap::horizontal_interval

The interval can describe a position on a planar plane or an angle. The interval is interpreted as defined by the horizontal projection type. In planar projection mode the horizontal intervals are x coordinates on an depth-image plane, with zero in the middle of the plane. In polar projection mode the horizontal intervals are angular rotations around the Z-unit axis. Horizontal angles must always be ordered from a higher to a smaller value, since the columns of the data matrices are interpreted from the left to the right. The field has either two or |horizontal_size| entries. In the case of two entries the intervals are interpreted as left and right boundaries. The transformation for each measurement will be interpolated.

◆ horizontal_projection

PROJECTION_TYPE base::samples::DepthMap::horizontal_projection

Defines the horizontal projection type of the depth map. If polar, the horizontal intervals are angular rotations around the Z-unit axis. If planar, the horizontal intervals are positions on an image plane coordinate frame.

◆ horizontal_size

uint32_t base::samples::DepthMap::horizontal_size

Number of horizontal depth samples

◆ remissions

std::vector<scalar> base::samples::DepthMap::remissions

The remission samples. This field is optional. The data is arranged in a row major order to simplify the usage as a remission image. The data for a value (vertical_index, horizontal_index) is in remissions[(vertical_index * horizontal_size) + horizontal_index].

◆ time

base::Time base::samples::DepthMap::time

Reference timestamp for the depth map sample. This timestamp is used for temporal alignment to other data samples and transformations. It is important to always set here a meaningful value.

◆ timestamps

std::vector<base::Time> base::samples::DepthMap::timestamps

The timestamps can be either one timestamp for all measurements, two for interpolation, per vertical entries, per horizontal entries or one per measurement.

◆ vertical_interval

std::vector<double> base::samples::DepthMap::vertical_interval

The interval can describe a position on a planar plane or an angle. The interval is interpreted as defined by the vertical projection type. In planar projection mode the vertical intervals are y coordinates on an depth-image plane, with zero in the middle of the plane. In polar projection mode the vertical intervals are angular rotations around the Y-unit axis. Vertical angles must always be ordered from a smaller to a higher value, since the rows of the data matrices are interpreted from the upper to the lower row. The field has either two or |vertical_size| entries. In the case of two entries the intervals are interpreted as upper and under boundaries. The transformation for each measurement will be interpolated.

◆ vertical_projection

PROJECTION_TYPE base::samples::DepthMap::vertical_projection

Defines the vertical projection type of the depth map. If polar, the vertical intervals are angular rotations around the Y-unit axis. If planar, the vertical intervals are positions on an image plane coordinate frame.

◆ vertical_size

uint32_t base::samples::DepthMap::vertical_size

Number of vertical depth samples


The documentation for this struct was generated from the following files: