* \param output_file Filename where descriptors will be saved.
* \param descriptor_set Descriptor set to be saved.
* \param conf Configureation parameters of the descriptors.
* Function to save to disc a set of descriptors computed in a range image. The conf parameter is used to check if descriptors corresponding to NaN 3D points have to be saved or discarded.
* Very simple class to hold 3D point position information.
* Very simple class to hold 3D point position information.
*/
*/
classP3D
classP3D
...
@@ -40,34 +40,46 @@ public:
...
@@ -40,34 +40,46 @@ public:
};
};
/** \brief Class to hold one FINDDD descriptor
/** \brief Class to hold one FINDDD descriptor.
* This class holds each one of the FINDDD descriptors in a set.
* This class holds each one of the FINDDD descriptors in a set.
* Descriptor data is stored in a vector<float>.
* Descriptor data is stored in a vector<float>.
*/
*/
classDescriptor
classDescriptor
{
{
public:
public:
/** X-coordinate of the descriptor in image. */
intu;
intu;
/** Y-coordinate of the descriptor in image. */
intv;
intv;
/** Orientation of the descriptor in image (not used yet). */
floatorientation;
floatorientation;
/** Corresponding 3D coordinates of the descriptor. */
P3Dpoint3d;
P3Dpoint3d;
/** Descriptor vector. */
std::vector<float>descriptor;
std::vector<float>descriptor;
};
};
/** \brief Class to hold FINDDD computation parameters
/** \brief Class to hold FINDDD computation parameters.
* This class holds a set (vector) of FINDDD descriptors as well as
* This class holds a set (vector) of FINDDD descriptors as well as
* parameters of the descriptors and the set and sizes of the original
* parameters of the descriptors in the set and sizes of the original
* range image.
* range image.
*/
*/
classDescriptorSet
classDescriptorSet
{
{
public:
public:
/** Number of orientation bins of each sub-descriptor. */
intnum_orient_bins;
intnum_orient_bins;
/** Number of spatial bins per side of the full descriptor region (sqrt of total). */
intnum_spa_bins;
intnum_spa_bins;
/** Number of descriptors. */
intnum;
intnum;
/** Number of dimensions of the descriptor. */
intlen;
intlen;
/** Width of the original range image. */
intwidth;
intwidth;
/** Height of the original range image. */
intheight;
intheight;
/** Vector with computed descriptor. */
std::vector<Descriptor>descriptors;
std::vector<Descriptor>descriptors;
DescriptorSet()
DescriptorSet()
...
@@ -82,26 +94,43 @@ public:
...
@@ -82,26 +94,43 @@ public:
};
};
/** \brief Class to hold FINDDD computation parameters
/** \brief Class to hold FINDDD computation parameters.
* This class holds all parameters related to FINDDD computation, and is
* This class holds all parameters related to FINDDD computation, and is
* used to update the FindddAlgorithm class with user-defined parameters.
* used to update the FindddAlgorithm class with user-defined parameters.
*/
*/
classFindddConfig
classFindddConfig
{
{
public:
public:
/** Num of spatial subdivisions. */
intnum_spatial_bins;
intnum_spatial_bins;
/** Side of the patch in pixels. */
intdesc_patch_radius;
intdesc_patch_radius;
//int patch_radius;
/** Step in pixels between descriptors. */
intsample_each;
intsample_each;
/** File with the normal centroids. */
std::stringcentroids_file;
std::stringcentroids_file;
/** File with the (u,v) positions where descriptors have to be computed (overrides "sample_each"). */
std::stringpositions_file;
std::stringpositions_file;
/** Normalization of new descriptors:
0 - No norm
1 - L1
2 - L2
3 - sqrt + L2
*/
intnormalize_desc;
intnormalize_desc;
/** Whether to use soft-voting or direct assignment. */
intuse_soft_voting;
intuse_soft_voting;
/** Input pcd file where descriptors have to be computed. */
std::stringpcd_file;
std::stringpcd_file;
/** Output file in "fvec" format containing the computed descriptors. */
std::stringgeofvecs_file;
std::stringgeofvecs_file;
/** Whether to keep NaN points or discard them. */
intkeep_nan_points;
intkeep_nan_points;
/** Name of a file containing the mean and the PCA matrix to automatically compress the computed descriptors. If not specified no compression is done. */
std::stringpca_file;
std::stringpca_file;
/** Verbosity level. */
intverbose_level;
intverbose_level;
FindddConfig()
FindddConfig()
{
{
verbose_level=1;
verbose_level=1;
...
@@ -119,7 +148,7 @@ public:
...
@@ -119,7 +148,7 @@ public:
}
}
};
};
/** \brief Main class to compute FINDDD descriptors
/** \brief Main class to compute FINDDD descriptors.
* This class contains all the methods necessary to compute FINDDD
* This class contains all the methods necessary to compute FINDDD
* descriptors for a range image.
* descriptors for a range image.
*/
*/
...
@@ -130,52 +159,72 @@ protected:
...
@@ -130,52 +159,72 @@ protected:
// private attributes and methods
// private attributes and methods
uintnt_;
uintnt_;
// [descriptor attributes]
/** Vector containing the X coordinate of normal centroids. */
std::vector<float>orient_bin_centers_x_;
std::vector<float>orient_bin_centers_x_;
/** Vector containing the Y coordinate of normal centroids. */
std::vector<float>orient_bin_centers_y_;
std::vector<float>orient_bin_centers_y_;
/** Vector containing the Z coordinate of normal centroids. */
std::vector<float>orient_bin_centers_z_;
std::vector<float>orient_bin_centers_z_;
/** Vector containing the U coordinate of points where descriptors have to be computed. */
std::vector<int>desc_compute_positionsX_;
std::vector<int>desc_compute_positionsX_;
/** Vector containing the V coordinate of points where descriptors have to be computed. */
std::vector<int>desc_compute_positionsY_;
std::vector<int>desc_compute_positionsY_;
/** Inter-bin distance, to compute soft-votes*/
floatradius_inf_;
floatradius_inf_;
/** Number of orientation bins in each sub-descriptor. */
uintdesc_num_orient_bins_;
uintdesc_num_orient_bins_;
/** Number of spatial bins per side of the full descriptor region (sqrt of total). */
uintdesc_num_side_spatial_bins_;
uintdesc_num_side_spatial_bins_;
/** Total size of the descriptors. */
uintdesc_num_total_bins_;
uintdesc_num_total_bins_;
/** Radius of area used to compute descriptor. */
uintdesc_patch_radius_;
uintdesc_patch_radius_;
/** Filename of the normal centroids. */
std::stringcentroids_file_;
std::stringcentroids_file_;
/** Filename of the file with positions where descriptors have to be computed (if specidied overrides "sample_each"). */
std::stringpositions_file_;
std::stringpositions_file_;
/** Name of file with mean and PCA matrix to compress descriptors on the fly. If not specified no compression is done. */
std::stringpca_file_;
std::stringpca_file_;
/** Normalization of new descriptors:
0 - No norm
1 - L1
2 - L2
3 - sqrt + L2
*/
uintnormalize_desc_;
uintnormalize_desc_;
/** Whether to use soft-voting or direct assignment. */
uintuse_soft_voting_;
uintuse_soft_voting_;
/** Level of verbosity. */
intverbose_level_;
intverbose_level_;
/** Step in pixels between descriptors. */
// [descriptor sampling attributes]
uintsample_each_;
uintsample_each_;
/** Margin to skip around the image. Currently this variable is unused. */
uintmargin_;
uintmargin_;
// [PCA stuff]
// [PCA stuff]
/** Variable holding the PCA matrix for on the fly compression. */
std::vector<std::vector<float>>pca_matrix_;
std::vector<std::vector<float>>pca_matrix_;
/** Mean of descriptors for PCA compression. */
std::vector<float>pca_mean_;
std::vector<float>pca_mean_;
public:
public:
/**
* \brief constructor
*
* In this constructor parameters related to the specific driver can be
* initalized. Those parameters can be also set in the openDriver() function.
* Attributes from the main node driver class IriBaseDriver such as loop_rate,
* may be also overload here.
*/
FindddAlgorithm();
FindddAlgorithm();
/**
* \brief constructor.
*
* Constructor that takes a FindddConfig object as input parameter.
*
*/
FindddAlgorithm(FindddConfigconf);
FindddAlgorithm(FindddConfigconf);
/**
/**
* \brief Set total descriptor bins
* \brief Set total descriptor bins.
*
*
* Given the current parameters, this function computes the total
* Given the current parameters, this function computes the total