45template <
typename Po
intSource,
typename Po
intTarget,
typename Scalar>
50 if (cloud->points.empty()) {
51 PCL_ERROR(
"[pcl::%s::setInputSource] Invalid or empty point cloud dataset given!\n",
52 getClassName().
c_str());
55 source_cloud_updated_ =
true;
59template <
typename Po
intSource,
typename Po
intTarget,
typename Scalar>
64 if (cloud->points.empty()) {
65 PCL_ERROR(
"[pcl::%s::setInputTarget] Invalid or empty point cloud dataset given!\n",
66 getClassName().
c_str());
70 target_cloud_updated_ =
true;
73template <
typename Po
intSource,
typename Po
intTarget,
typename Scalar>
78 PCL_ERROR(
"[pcl::registration::%s::compute] No input target dataset was given!\n",
79 getClassName().
c_str());
84 if (target_cloud_updated_ && !force_no_recompute_) {
85 tree_->setInputCloud(target_);
86 target_cloud_updated_ =
false;
90 if (correspondence_estimation_) {
91 correspondence_estimation_->setSearchMethodTarget(tree_, force_no_recompute_);
92 correspondence_estimation_->setSearchMethodSource(tree_reciprocal_,
93 force_no_recompute_reciprocal_);
103template <
typename Po
intSource,
typename Po
intTarget,
typename Scalar>
108 PCL_ERROR(
"[pcl::registration::%s::compute] No input source dataset was given!\n",
109 getClassName().
c_str());
113 if (source_cloud_updated_ && !force_no_recompute_reciprocal_) {
114 tree_reciprocal_->setInputCloud(input_);
115 source_cloud_updated_ =
false;
120template <
typename Po
intSource,
typename Po
intTarget,
typename Scalar>
132template <
typename Po
intSource,
typename Po
intTarget,
typename Scalar>
136 double fitness_score = 0.0;
160 return (fitness_score /
nr);
161 return (std::numeric_limits<double>::max());
164template <
typename Po
intSource,
typename Po
intTarget,
typename Scalar>
168 align(
output, Matrix4::Identity());
171template <
typename Po
intSource,
typename Po
intTarget,
typename Scalar>
180 output.resize(indices_->size());
182 output.header = input_->header;
184 if (indices_->size() != input_->size()) {
189 output.width =
static_cast<std::uint32_t
>(input_->width);
190 output.height = input_->height;
192 output.is_dense = input_->is_dense;
195 for (std::size_t i = 0; i < indices_->size(); ++i)
196 output[i] = (*input_)[(*indices_)[i]];
199 if (point_representation_ && !force_no_recompute_)
200 tree_->setPointRepresentation(point_representation_);
204 final_transformation_ = transformation_ = previous_transformation_ =
209 for (std::size_t i = 0; i < indices_->size(); ++i)
Iterator class for point clouds with or without given indices.
ConstCloudIterator(const PointCloud< PointT > &cloud)
std::size_t size() const
Size of the range the iterator is going through.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Provide a pointer to the input dataset.
bool initCompute()
Internal computation initialization.
virtual void setInputSource(const PointCloudSourceConstPtr &cloud)
Provide a pointer to the input source (e.g., the point cloud that we want to align to the target)
typename PointCloudSource::ConstPtr PointCloudSourceConstPtr
virtual void setInputTarget(const PointCloudTargetConstPtr &cloud)
Provide a pointer to the input target (e.g., the point cloud that we want to align the input source t...
typename PointCloudTarget::ConstPtr PointCloudTargetConstPtr
Eigen::Matrix< Scalar, 4, 4 > Matrix4
void align(PointCloudSource &output)
Call the registration algorithm which estimates the transformation and returns the transformed source...
double getFitnessScore(double max_range=std::numeric_limits< double >::max())
Obtain the Euclidean fitness score (e.g., mean of squared distances from the source to the target)
bool initComputeReciprocal()
Internal computation when reciprocal lookup is needed.
void transformPointCloud(const pcl::PointCloud< PointT > &cloud_in, pcl::PointCloud< PointT > &cloud_out, const Eigen::Matrix< Scalar, 4, 4 > &transform, bool copy_all_fields)
Apply a rigid transform defined by a 4x4 matrix.