ICP  1.1.0
 Hosted by GitHub
Public Types | Public Member Functions | Public Attributes | Protected Attributes | List of all members
cl_algo::ICP::ICPStep< ICPStepConfigT::POWER_METHOD, ICPStepConfigW::REGULAR > Class Template Reference

Interface class for the ICP pipeline using the Power Method to estimate the rotation and considering regular residual errors. More...

#include <algorithms.hpp>

Collaboration diagram for cl_algo::ICP::ICPStep< ICPStepConfigT::POWER_METHOD, ICPStepConfigW::REGULAR >:
Collaboration graph
[legend]

Public Types

enum  Memory : uint8_t {
  Memory::H_IN_F, Memory::H_IN_M, Memory::H_IO_T, Memory::D_IN_F,
  Memory::D_IN_M, Memory::D_IO_T
}
 Enumerates the memory objects handled by the class. More...
 

Public Member Functions

 ICPStep (clutils::CLEnv &_env, clutils::CLEnvInfo< 1 > _infoRBC, clutils::CLEnvInfo< 1 > _infoICP)
 Configures an OpenCL environment as specified by _info. More...
 
cl::Memory & get (ICPStep::Memory mem)
 Returns a reference to an internal memory object. More...
 
void init (unsigned int _m, unsigned int _nr, float _a=1e2f, float _c=1e-6f, Staging _staging=Staging::IO)
 Configures kernel execution parameters. More...
 
void write (ICPStep::Memory mem=ICPStep::Memory::D_IN_F, void *ptr=nullptr, bool block=CL_FALSE, const std::vector< cl::Event > *events=nullptr, cl::Event *event=nullptr)
 Performs a data transfer to a device buffer. More...
 
void * read (ICPStep::Memory mem=ICPStep::Memory::H_IO_T, bool block=CL_TRUE, const std::vector< cl::Event > *events=nullptr, cl::Event *event=nullptr)
 Performs a data transfer to a staging buffer. More...
 
void buildRBC (const std::vector< cl::Event > *events=nullptr, cl::Event *event=nullptr)
 Builds the RBC data structure. More...
 
void run (const std::vector< cl::Event > *events=nullptr, cl::Event *event=nullptr, bool config=false)
 Executes the necessary kernels. More...
 
float getAlpha ()
 Gets the scaling parameter \( \alpha \) involved in the distance calculations of the RBC data structure. More...
 
void setAlpha (float _a)
 Sets the scaling parameter \( \alpha \) involved in the distance calculations of the RBC data structure. More...
 
float getScaling ()
 Gets the scaling factor c used when computing the S matrix. More...
 
void setScaling (float _c)
 Sets the scaling factor c used when computing the S matrix. More...
 
template<typename period >
double run (clutils::GPUTimer< period > &timer, const std::vector< cl::Event > *events=nullptr, bool config=false)
 Executes the necessary kernels. More...
 

Public Attributes

cl_float * hPtrInF
 
cl_float * hPtrInM
 
cl_float * hPtrIOT
 
Eigen::Matrix3f Rk
 
Eigen::Quaternionf qk
 
Eigen::Vector3f tk
 
cl_float sk
 
Eigen::Matrix3f R
 
Eigen::Quaternionf q
 
Eigen::Vector3f t
 
cl_float s
 

Protected Attributes

clutils::CLEnv & env
 
clutils::CLEnvInfo< 1 > infoRBC
 
clutils::CLEnvInfo< 1 > infoICP
 
cl::Context context
 
cl::CommandQueue queue
 
Staging staging
 
ICPReps fReps
 
RBC::RBCConstruct< RBC::KernelTypeC::KINECT_R, RBC::RBCPermuteConfig::GENERIC > rbcC
 
ICPTransform< ICPTransformConfig::QUATERNIONtransform
 
RBC::RBCSearch< RBC::KernelTypeC::KINECT_R, RBC::RBCPermuteConfig::GENERIC, RBC::KernelTypeS::KINECT > rbcS
 
ICPMean< ICPMeanConfig::REGULARmeans
 
ICPDevs devs
 
ICPS< ICPSConfig::REGULARmatrixS
 
ICPPowerMethod powMethod
 
cl_float * Tk
 
float a
 
float c
 
unsigned int m
 
unsigned int nr
 
unsigned int d
 
unsigned int bufferFMSize
 
unsigned int bufferTSize
 
cl::Buffer hBufferInF
 
cl::Buffer hBufferInM
 
cl::Buffer hBufferIOT
 
cl::Buffer dBufferInF
 
cl::Buffer dBufferInM
 
cl::Buffer dBufferIOT
 

Detailed Description

template<>
class cl_algo::ICP::ICPStep< ICPStepConfigT::POWER_METHOD, ICPStepConfigW::REGULAR >

Interface class for the ICP pipeline using the Power Method to estimate the rotation and considering regular residual errors.

Performs one ICP iteration. It accepts two sets (fixed and moving) of landmarks, estimates the relative homogeneous transformation \( (\dot{q}_k,t_k) \) between them, and transforms the moving set according to this transformation.

Note
All computation is done on the GPU. The rotation computation is also solved on the GPU with the Power Method.
The class creates its own buffers. If you would like to provide your own buffers, call get to get references to the placeholders within the class and assign them to your buffers. You will have to do this strictly before the call to init. You can also call get (after the call to init) to get a reference to a buffer within the class and assign it to another kernel class instance further down in your task pipeline.

The following input/output OpenCL memory objects are created by a ICPStep<ICPStepConfigT::POWER_METHOD, ICPStepConfigW::REGULAR> instance:

Name Type Placement I/O Use Properties Size
H_IN_F Buffer Host I Staging CL_MEM_READ_WRITE \(m*sizeof\ (cl\_float8)\)
H_IN_M Buffer Host I Staging CL_MEM_READ_WRITE \(m*sizeof\ (cl\_float8)\)
H_IO_T Buffer Host IOStaging CL_MEM_READ_WRITE \(2*sizeof\ (cl\_float4)\)
D_IN_F Buffer Device I Processing CL_MEM_READ_ONLY \(m*sizeof\ (cl\_float8)\)
D_IN_M Buffer Device I Processing CL_MEM_READ_ONLY \(m*sizeof\ (cl\_float8)\)
D_IO_T Buffer Device IOProcessing CL_MEM_READ_WRITE \(2*sizeof\ (cl\_float4)\)

Member Enumeration Documentation

Enumerates the memory objects handled by the class.

Note
H_* names refer to staging buffers on the host.
D_* names refer to buffers on the device.
Enumerator
H_IN_F 

Input staging buffer for the fixed set of landmarks.

H_IN_M 

Input staging buffer for the moving set of landmarks.

H_IO_T 

Input-output staging buffer for the quaternion and the translation vector. It is loaded with an initial estimation of the transformation and gets refined with every ICP iteration. The first cl_float4 element contains the quaternion, \( \dot{q} = \left[ \begin{matrix} q_x & q_y & q_z & q_w \end{matrix} \right]^T \), and the second cl_float4 element contains the translation vector, \( t = \left[ \begin{matrix} t_x & t_y & t_z & 1 \end{matrix} \right]^T \). If scaling is desired, the factor should be placed in the last element of the translation vector, \( t = \left[ \begin{matrix} t_x & t_y & t_z & s \end{matrix} \right]^T \).

D_IN_F 

Input buffer for the fixed set of landmarks.

D_IN_M 

Input buffer for the moving set of landmarks.

D_IO_T 

Input-output buffer for the quaternion and the translation vector. It is loaded with an initial estimation of the transformation and gets refined with every ICP iteration. The first cl_float4 element contains the quaternion, \( \dot{q} = \left[ \begin{matrix} q_x & q_y & q_z & q_w \end{matrix} \right]^T \), and the second cl_float4 element contains the translation vector, \( t = \left[ \begin{matrix} t_x & t_y & t_z & 1 \end{matrix} \right]^T \). If scaling is desired, the factor should be placed in the last element of the translation vector, \( t = \left[ \begin{matrix} t_x & t_y & t_z & s \end{matrix} \right]^T \).

Constructor & Destructor Documentation

cl_algo::ICP::ICPStep< ICPStepConfigT::POWER_METHOD, ICPStepConfigW::REGULAR >::ICPStep ( clutils::CLEnv &  _env,
clutils::CLEnvInfo< 1 >  _infoRBC,
clutils::CLEnvInfo< 1 >  _infoICP 
)

Configures an OpenCL environment as specified by _info.

Parameters
[in]_envopencl environment.
[in]_infoRBCopencl configuration for the RBC classes. It specifies the context, queue, etc, to be used.
[in]_infoICPopencl configuration for the ICP classes. It specifies the context, queue, etc, to be used.

Member Function Documentation

void cl_algo::ICP::ICPStep< ICPStepConfigT::POWER_METHOD, ICPStepConfigW::REGULAR >::buildRBC ( const std::vector< cl::Event > *  events = nullptr,
cl::Event *  event = nullptr 
)

Builds the RBC data structure.

Note
Call buildRBC after the D_IN_F buffer has been written, and before any calls to run (for each registration).

Returns a reference to an internal memory object.

This interface exists to allow CL memory sharing between different kernels.

Parameters
[in]memenumeration value specifying the requested memory object.
Returns
A reference to the requested memory object.

Gets the scaling parameter \( \alpha \) involved in the distance calculations of the RBC data structure.

Returns
The scaling parameter \( \alpha \).

Gets the scaling factor c used when computing the S matrix.

Note
The scaling factor c multiplies the points (deviations) before processing in order to deal with floating point arithmetic issues.
Returns
The scaling factor c.
void cl_algo::ICP::ICPStep< ICPStepConfigT::POWER_METHOD, ICPStepConfigW::REGULAR >::init ( unsigned int  _m,
unsigned int  _nr,
float  _a = 1e2f,
float  _c = 1e-6f,
Staging  _staging = Staging::IO 
)

Configures kernel execution parameters.

Sets up memory objects as necessary, and defines the kernel workspaces.

Note
If you have assigned a memory object to one member variable of the class before the call to init, then that memory will be maintained. Otherwise, a new memory object will be created.
Parameters
[in]_mnumber of points in the sets.
[in]_nrnumber of fixed set representatives.
[in]_afactor scaling the results of the distance calculations for the geometric \( x_g \) and photometric \( x_p \) dimensions of the \( x\epsilon\mathbb{R}^8 \) points. That is, \( \|x-x'\|_2^2= f_g(a)\|x_g-x'_g\|_2^2+f_p(a)\|x_p-x'_p\|_2^2 \). For more info, look at euclideanSquaredMetric8 in kernels/rbc_kernels.cl.
[in]_cscaling factor for dealing with floating point arithmetic issues when computing the S matrix.
[in]_stagingflag to indicate whether or not to instantiate the staging buffers.
void * cl_algo::ICP::ICPStep< ICPStepConfigT::POWER_METHOD, ICPStepConfigW::REGULAR >::read ( ICPStep< ICPStepConfigT::POWER_METHOD, ICPStepConfigW::REGULAR >::Memory  mem = ICPStepICPStepConfigT::POWER_METHODICPStepConfigW::REGULAR >::Memory::H_IO_T,
bool  block = CL_TRUE,
const std::vector< cl::Event > *  events = nullptr,
cl::Event *  event = nullptr 
)

Performs a data transfer to a staging buffer.

The transfer happens from a device buffer to the associated (specified) staging buffer on the host.

Parameters
[in]memenumeration value specifying an output staging buffer.
[in]blocka flag to indicate whether to perform a blocking or a non-blocking operation.
[in]eventsa wait-list of events.
[out]eventevent associated with the read operation to the staging buffer.
void cl_algo::ICP::ICPStep< ICPStepConfigT::POWER_METHOD, ICPStepConfigW::REGULAR >::run ( const std::vector< cl::Event > *  events = nullptr,
cl::Event *  event = nullptr,
bool  config = false 
)

Executes the necessary kernels.

The function call is non-blocking.

Parameters
[in]eventsa wait-list of events.
[out]eventevent associated with the kernel execution.
[in]configflag. If true, configures the RBC search process. Set to true once, when the RBC data structure is reset.
template<typename period >
double cl_algo::ICP::ICPStep< ICPStepConfigT::POWER_METHOD, ICPStepConfigW::REGULAR >::run ( clutils::GPUTimer< period > &  timer,
const std::vector< cl::Event > *  events = nullptr,
bool  config = false 
)
inline

Executes the necessary kernels.

This run instance is used for profiling.

Parameters
[in]timerGPUTimer that does the profiling of the kernel executions.
[in]eventsa wait-list of events.
[in]configflag. If true, configures the RBC search process. Set to true once, when the RBC data structure is reset.
Returns
Τhe total execution time measured by the timer.

Sets the scaling parameter \( \alpha \) involved in the distance calculations of the RBC data structure.

Updates the kernel arguments for the scaling parameter \( \alpha \).

Parameters
[in]_ascaling parameter \( \alpha \).

Sets the scaling factor c used when computing the S matrix.

Updates the kernel argument for the scaling factor c.

Note
The scaling factor c multiplies the points (deviations) before processing in order to deal with floating point arithmetic issues.
Parameters
[in]_cscaling factor.
void cl_algo::ICP::ICPStep< ICPStepConfigT::POWER_METHOD, ICPStepConfigW::REGULAR >::write ( ICPStep< ICPStepConfigT::POWER_METHOD, ICPStepConfigW::REGULAR >::Memory  mem = ICPStepICPStepConfigT::POWER_METHODICPStepConfigW::REGULAR >::Memory::D_IN_F,
void *  ptr = nullptr,
bool  block = CL_FALSE,
const std::vector< cl::Event > *  events = nullptr,
cl::Event *  event = nullptr 
)

Performs a data transfer to a device buffer.

The transfer happens from a staging buffer on the host to the associated (specified) device buffer.

Parameters
[in]memenumeration value specifying an input device buffer.
[in]ptra pointer to an array holding input data. If not NULL, the data from ptr will be copied to the associated staging buffer.
[in]blocka flag to indicate whether to perform a blocking or a non-blocking operation.
[in]eventsa wait-list of events.
[out]eventevent associated with the write operation to the device buffer.

Member Data Documentation

Mapping of the input staging buffer for the fixed set of points.

Mapping of the input staging buffer for the moving set of points.

Mapping of the input-output staging buffer for the estimated quaternion and translation vector.

clutils::CLEnvInfo<1> cl_algo::ICP::ICPStep< ICPStepConfigT::POWER_METHOD, ICPStepConfigW::REGULAR >::infoICP
protected
clutils::CLEnvInfo<1> cl_algo::ICP::ICPStep< ICPStepConfigT::POWER_METHOD, ICPStepConfigW::REGULAR >::infoRBC
protected

Represents the rotation estimation up to iteration k, given in quaternion representation, \( \dot{q} = \left[ \begin{matrix} q_x & q_y & q_z & q_w \end{matrix} \right]^T \).

Represents the incremental development in the rotation estimation in iteration k, given in quaternion representation, \( \dot{q}_k = \left[ \begin{matrix} q_x & q_y & q_z & q_w \end{matrix} \right]^T \).

Represents the rotation estimation up to iteration k, given in rotation matrix representation, \( R \).

RBC::RBCConstruct<RBC::KernelTypeC::KINECT_R, RBC::RBCPermuteConfig::GENERIC> cl_algo::ICP::ICPStep< ICPStepConfigT::POWER_METHOD, ICPStepConfigW::REGULAR >::rbcC
protected
RBC::RBCSearch<RBC::KernelTypeC::KINECT_R, RBC::RBCPermuteConfig::GENERIC, RBC::KernelTypeS::KINECT> cl_algo::ICP::ICPStep< ICPStepConfigT::POWER_METHOD, ICPStepConfigW::REGULAR >::rbcS
protected

Represents the incremental development in the rotation estimation in iteration k, given in rotation matrix representation, \( R_k \).

Represents the scale estimation up to iteration k, given as a scalar, \( s \).

Represents the incremental development in the scale estimation in iteration k, given as a scalar, \( s_k \).

Represents the translation estimation up to iteration k, given as a vector in 3-D, \( t \).

Represents the incremental development in the translation estimation in iteration k, given as a vector in 3-D, \( t_k \).


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