Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ReLOC - Initial alignment algorithm #1614

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

aliosciapetrelli
Copy link
Contributor

ReLOC is an initial alignment algorithm proposed in:
Petrelli A., Di Stefano L., "Pairwise registration by local orientation cues", Computer Graphics Forum, 2015.

It requires the FLARE method for the computation of repeatable reference frames. FLARE method is implemented by the FLARELocalReferenceFrameEstimation class proposed through the pull request #1571.

ReLOC requires also some changes of Hough Voting and RANSAC. Moreover, it introduces the FlatKeypoint detector.

@aliosciapetrelli
Copy link
Contributor Author

The pull request has been rebased and all the fixes has been squashed.

@SergioRAgostinho SergioRAgostinho added this to the pcl-1.9.0 milestone Jul 14, 2016
@SergioRAgostinho SergioRAgostinho added the needs: code review Specify why not closed/merged yet label Jul 14, 2016
@SergioRAgostinho SergioRAgostinho self-requested a review June 28, 2017 20:21
@SergioRAgostinho
Copy link
Member

I've started looking into this. There's quite a lot of changes so it might take me some time to go through all of it.

@taketwo
Copy link
Member

taketwo commented Jun 28, 2017

This PR is really complex! Would it make sense to subdivide it?

For example

  • moving HoughSpace3D to another module can definitely be a separate one.
  • in the first commit you strip some functions from the BOARD and move elsewhere. I think this kind of change deserves it's own PR and discussion. Potentially this is a breaking change, so would be nice to be able to refer to it or revert it independently of the rest.
  • FlatDetector is a standalone feature, can also go in it's own PR.

@SergioRAgostinho what do you think?

Copy link
Member

@SergioRAgostinho SergioRAgostinho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just reviewed your first commit. Let's start the discussion with only these carry on from there.

using namespace pcl::io;
using namespace pcl::registration;
using namespace std;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove all using namespace. Just the symbols you need. You even use the fully qualified names after.

cout << "Load target" << endl;
pcl::PointCloud<pcl::PointXYZ>::Ptr target (new pcl::PointCloud<pcl::PointXYZ>);

if (pcl::io::loadPCDFile<pcl::PointXYZ> ("bun0.ply", *target) == -1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You use loadPCDFile but then mention a ply. Fetch the path to the files from argv and make a comment on top saying that these file are available on pcl/tests

cout << "Load source" << endl;
pcl::PointCloud<pcl::PointXYZ>::Ptr source (new pcl::PointCloud<pcl::PointXYZ>);

if (pcl::io::loadPCDFile<pcl::PointXYZ> ("bun4.ply", *source) == -1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

}

//apply a translation to the target for better disambiguation of normal signs
Eigen::Vector3f translation_target;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eigen supports a constructor in which you can initialize immediately all three values. Can be declared const.

translation_target[0] = 0;
translation_target[1] = -0.3;
translation_target[2] = 0.5;
Eigen::Quaternionf rotation_target(0.0f, 0.0f, 0.0f, 0.0f);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be declared const.

A (i, 1) = points (i, 1) - centroid.y ();
A (i, 2) = points (i, 2) - centroid.z ();
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const Eigen::Matrix<float, Eigen::Dynamic, 3> A (points.rowwise () - centroid.transpose ());

* Software License Agreement (BSD License)
*
* Point Cloud Library (PCL) - www.pointclouds.org
* Copyright (c) 2010-2012, Willow Garage, Inc.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on the copyright

using namespace pcl::test;
using namespace pcl::io;
using namespace std;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove all using namespace. Just apply usingto all symbols you actually use.

#include <gtest/gtest.h>
#include <pcl/point_cloud.h>
#include <pcl/pcl_tests.h>
#include <pcl/features/normal_3d_omp.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need the normal one, not the omp enabled one.

PointCloud<Normal>::Ptr normals (new PointCloud<Normal> ());
PointCloud<ReferenceFrame> bunny_LRF;

float meshRes = 0.005f;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Const

@SergioRAgostinho
Copy link
Member

@taketwo Agree with everything.

@taketwo taketwo added needs: author reply Specify why not closed/merged yet and removed needs: code review Specify why not closed/merged yet labels Jul 5, 2017
@stale
Copy link

stale bot commented Dec 14, 2017

This pull request has been automatically marked as stale because it hasn't had
any activity in the past 60 days. Commenting or adding a new commit to the
pull request will revert this.

Come back whenever you have time. We look forward to your contribution.

@stale stale bot added the status: stale label Dec 14, 2017
aliosciapetrelli and others added 9 commits December 26, 2017 19:10
- Add FLARELocalReferenceFrameEstimation class
- Add unit test for FLARELocalReferenceFrameEstimation class
- Add LRF_utils.h
- Add LRF_utils.cpp
- Add directedOrthogonalAxis, projectPointOnPlane in lrf_utils
- getAngleBetweenUnitVectors, randomOrthogonalAxis, normalDisambiguation
and planeFitting methods of BOARDLocalReferenceFrameEstimation class
moved to lrf_utils.hpp
Move HoughSpace3D class from recognition library to geometry package
Add hough_space_3d.h in geometry package
Add hough_space_3d.hpp in geometry package

Motivation:
As recognition library depends on registration library and  HoughSpace3D
in recognition library will be used by ReLOCInitialAlignment class in
registration library, adding ReLOCInitialAlignment would create a
circular dependency.

Solution:
Move HoughSpace3D to a lower level package, whereas Hough3DGrouping
remains in recognition library.
Comment if (indices_->size () > input_->points.size ())

Constructor of SampleConsensusModel assumes that the number of matches
is lesser than the number of points. This is not always true. For
example, in the case a radius search or a k-nn search (with k>1) is
applied.
…ute()

initCompute() of registration class set correspondence_estimation_ and
set target_cloud_updated_ to false. Such operations could be useless or
even improper for the classes deriving from registration.

Adding virtual solve the problem.
Detector of flat keypoints proposed in:
Petrelli A., Di Stefano L., "Pairwise registration by local orientation
cues", Computer Graphics Forum, 2015

and used by ReLOC initial alignment algorithm.
ReLOC is an initial alignment algorithm proposed in:
Petrelli A., Di Stefano L., "Pairwise registration by local orientation
cues", Computer Graphics Forum, 2015.

Add ia_ReLOC.h
Add ia_ReLOC.hpp
Add ia_ReLOC.cpp
Add test_ReLOC_ia.cpp
ReLOC is an initial alignment algorithm proposed in:
Petrelli A., Di Stefano L., "Pairwise registration by local orientation
cues", Computer Graphics Forum, 2015.

Add doc\tutorials\content\images\registration\ReLOC.png
Modify doc\tutorials\content\index.rst
Add doc\tutorials\content\ReLOC.rst
Add doc\tutorials\content\sources\ReLOC\CMakeLists.txt
Add doc\tutorials\content\sources\ReLOC\ReLOC.cpp
Replace rand() with std::uniform_int_distribution<int> uniformRandomGenerator() so as to extract keypoints uniformly in clouds with more than RAND_MAX points.
Alioscia Petrelli added 4 commits December 28, 2017 17:12
This reverts commit 1224939.

As FLARELocalReferenceFrameEstimation class has been already added by pull request PointCloudLibrary#1571
Replace tabs with spaces
Remove spaces and comments
Alioscia Petrelli and others added 5 commits January 20, 2018 12:39
Move extendBBox in geometry.h
Move computeBBoxFromStddev in centroid.h and rename it as computeBBoxFromPointDistribution

Replace the matching stage explained in the paper with a simpler radius search in the one-dimensional space of the FLARE signed distances.
@aliosciapetrelli
Copy link
Contributor Author

Hi,
I revised all the code on the basis of the reviews of FLARE algorithm.
You can now start the reviews. Thanks.

@SergioRAgostinho
Copy link
Member

👍 Thanks @aliosciapetrelli . It might take some time as usual, but we'll get to it eventually.

@SergioRAgostinho SergioRAgostinho added needs: code review Specify why not closed/merged yet and removed needs: author reply Specify why not closed/merged yet labels Jan 22, 2018
@SergioRAgostinho SergioRAgostinho removed this from the pcl-1.9.0 milestone Aug 26, 2018
@stale
Copy link

stale bot commented Feb 21, 2020

This pull request has been automatically marked as stale because it hasn't had
any activity in the past 60 days. Commenting or adding a new commit to the
pull request will revert this.

Come back whenever you have time. We look forward to your contribution.

@stale stale bot added the status: stale label Feb 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: code review Specify why not closed/merged yet status: stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants