base
|
#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< DepthMatrix > | DepthMatrixMap |
typedef const Eigen::Map< DepthMatrixConst > | DepthMatrixMapConst |
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::Time > | timestamps |
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< scalar > | distances |
std::vector< scalar > | remissions |
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 |
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.
typedef Eigen::Matrix<scalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::DontAlign | Eigen::RowMajor> base::samples::DepthMap::DepthMatrix |
typedef const Eigen::Matrix<scalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::DontAlign | Eigen::RowMajor> base::samples::DepthMap::DepthMatrixConst |
typedef Eigen::Map< DepthMatrix > base::samples::DepthMap::DepthMatrixMap |
typedef const Eigen::Map< DepthMatrixConst > base::samples::DepthMap::DepthMatrixMapConst |
typedef float base::samples::DepthMap::scalar |
typedef boost::uint32_t base::samples::DepthMap::uint32_t |
|
inline |
|
protected |
Checks if the vertical and horizontal sizes match the size of distance vector.
|
inlineprotected |
Helper method to compute the local rows2column and columns2pointcloud transformations.
|
inlineprotected |
Computes the resolution in a given interval.
|
inlineprotected |
Helper method to compute the rotations around an unit axis.
|
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.
point_cloud | returned pointcloud |
use_lut | true, if lookup table for single unit axis rotations shall be used |
skip_invalid_measurements | true, if invalid measurements should be skipped |
|
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.
point_cloud | returned pointcloud |
transformation | all points will be transformed using this transformation |
use_lut | true, if lookup table for single unit axis rotations shall be used |
skip_invalid_measurements | true, if invalid measurements should be skipped |
|
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.
point_cloud | returned pointcloud |
first_transformation | transformation of the first row or column |
last_transformation | translation of the last row or column |
use_lut | true, if lookup table for single unit axis rotations shall be used |
skip_invalid_measurements | true, if invalid measurements should be skipped |
apply_transforms_vertically | true, if transformations should be applied row-wise |
|
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.
point_cloud | returned pointcloud |
transformations | vector of transformation matrices |
use_lut | true, if lookup table for single unit axis rotations shall be used |
skip_invalid_measurements | true, if invalid measurements should be skipped |
apply_transforms_vertically | true, if transformations should be applied row-wise |
|
inlineprotected |
Helper method which converts a single row to a pointcloud.
DepthMap::DepthMatrixMap base::samples::DepthMap::getDistanceMatrixMap | ( | ) |
Creates a mapping to a eigen matrix with dynamic sizes
DepthMap::DepthMatrixMapConst base::samples::DepthMap::getDistanceMatrixMapConst | ( | ) | const |
Creates a mapping to a const eigen matrix with dynamic sizes
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.
DepthMap::DEPTH_MEASUREMENT_STATE base::samples::DepthMap::getIndexState | ( | size_t | index | ) | const |
Returns the measurement state of a given index.
index | of the measurement |
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.
v_index | |
h_index |
DepthMap::DEPTH_MEASUREMENT_STATE base::samples::DepthMap::getMeasurementState | ( | DepthMap::scalar | distance | ) | const |
Returns the measurement state of a given measurement
distance | measurement |
bool base::samples::DepthMap::isIndexValid | ( | size_t | index | ) | const |
Returns true if the measurement at the given index is valid.
index | of the measurement |
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.
v_index | |
h_index |
bool base::samples::DepthMap::isMeasurementValid | ( | DepthMap::scalar | distance | ) | const |
Returns true if the measurement is valid.
distance | measurement |
void base::samples::DepthMap::reset | ( | ) |
Reset the sample
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].
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.
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.
uint32_t base::samples::DepthMap::horizontal_size |
Number of horizontal depth samples
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].
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.
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.
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.
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.
uint32_t base::samples::DepthMap::vertical_size |
Number of vertical depth samples