Skip to content

Commit

Permalink
Merge branch 'master' into fix_logo
Browse files Browse the repository at this point in the history
  • Loading branch information
jspricke authored Oct 12, 2018
2 parents b8ab9ba + 5c9bd63 commit d871977
Show file tree
Hide file tree
Showing 10 changed files with 576 additions and 693 deletions.
6 changes: 0 additions & 6 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,10 @@ build_script:
# These tests will fails on Windows.
# Therefore, these tests are disabled until fixed.
# AppVeyor Log : https://ci.appveyor.com/project/PointCloudLibrary/pcl/build/1.0.267
# * test_2d
# * common_eigen
# * feature_rift_estimation
# * feature_cppf_estimation
# * feature_pfh_estimation
# * filters_sampling
# * io_grabbers
# * registration_api
- call "%VCVARSALL%" %ARCHITECTURE%
- cd %APPVEYOR_BUILD_FOLDER%
- mkdir build
Expand All @@ -96,8 +92,6 @@ build_script:
-DBUILD_global_tests=ON
-DBUILD_simulation=OFF
-DBUILD_tools=OFF
-DBUILD_tests_features=OFF
-DBUILD_tests_filters=OFF
..
- cmake --build . --config %CONFIGURATION%
- ctest -C %CONFIGURATION% -V
Expand Down
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,6 @@ jobs:
compiler: gcc
env: TASK="test"
script: bash .travis.sh $TASK

notifications:
email: false
2 changes: 1 addition & 1 deletion filters/include/pcl/filters/covariance_sampling.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ namespace pcl
/** \brief Compute the condition number of the input point cloud. The condition number is the ratio between the
* largest and smallest eigenvalues of the 6x6 covariance matrix of the cloud. The closer this number is to 1.0,
* the more stable the cloud is for ICP registration.
* \param[in] covariance_matrix user given covariance matrix
* \param[in] covariance_matrix user given covariance matrix. Assumed to be self adjoint/symmetric.
* \return the condition number
*/
static double
Expand Down
65 changes: 9 additions & 56 deletions filters/include/pcl/filters/impl/covariance_sampling.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,46 +88,17 @@ pcl::CovarianceSampling<PointT, PointNT>::computeConditionNumber ()
if (!computeCovarianceMatrix (covariance_matrix))
return (-1.);

Eigen::EigenSolver<Eigen::Matrix<double, 6, 6> > eigen_solver;
eigen_solver.compute (covariance_matrix, true);

Eigen::MatrixXcd complex_eigenvalues = eigen_solver.eigenvalues ();

double max_ev = -std::numeric_limits<double>::max (),
min_ev = std::numeric_limits<double>::max ();
for (size_t i = 0; i < 6; ++i)
{
if (real (complex_eigenvalues (i, 0)) > max_ev)
max_ev = real (complex_eigenvalues (i, 0));

if (real (complex_eigenvalues (i, 0)) < min_ev)
min_ev = real (complex_eigenvalues (i, 0));
}

return (max_ev / min_ev);
return computeConditionNumber (covariance_matrix);
}


///////////////////////////////////////////////////////////////////////////////
template<typename PointT, typename PointNT> double
pcl::CovarianceSampling<PointT, PointNT>::computeConditionNumber (const Eigen::Matrix<double, 6, 6> &covariance_matrix)
{
Eigen::EigenSolver<Eigen::Matrix<double, 6, 6> > eigen_solver;
eigen_solver.compute (covariance_matrix, true);

Eigen::MatrixXcd complex_eigenvalues = eigen_solver.eigenvalues ();

double max_ev = -std::numeric_limits<double>::max (),
min_ev = std::numeric_limits<double>::max ();
for (size_t i = 0; i < 6; ++i)
{
if (real (complex_eigenvalues (i, 0)) > max_ev)
max_ev = real (complex_eigenvalues (i, 0));

if (real (complex_eigenvalues (i, 0)) < min_ev)
min_ev = real (complex_eigenvalues (i, 0));
}

const Eigen::SelfAdjointEigenSolver<Eigen::Matrix<double, 6, 6> > solver (covariance_matrix, Eigen::EigenvaluesOnly);
const double max_ev = solver.eigenvalues (). maxCoeff ();
const double min_ev = solver.eigenvalues (). minCoeff ();
return (max_ev / min_ev);
}

Expand Down Expand Up @@ -158,31 +129,13 @@ pcl::CovarianceSampling<PointT, PointNT>::computeCovarianceMatrix (Eigen::Matrix
template<typename PointT, typename PointNT> void
pcl::CovarianceSampling<PointT, PointNT>::applyFilter (std::vector<int> &sampled_indices)
{
if (!initCompute ())
Eigen::Matrix<double, 6, 6> c_mat;
// Invokes initCompute()
if (!computeCovarianceMatrix (c_mat))
return;

//--- Part A from the paper
// Set up matrix F
Eigen::Matrix<double, 6, Eigen::Dynamic> f_mat = Eigen::Matrix<double, 6, Eigen::Dynamic> (6, indices_->size ());
for (size_t p_i = 0; p_i < scaled_points_.size (); ++p_i)
{
f_mat.block<3, 1> (0, p_i) = scaled_points_[p_i].cross (
(*input_normals_)[(*indices_)[p_i]].getNormalVector3fMap ()).template cast<double> ();
f_mat.block<3, 1> (3, p_i) = (*input_normals_)[(*indices_)[p_i]].getNormalVector3fMap ().template cast<double> ();
}

// Compute the covariance matrix C and its 6 eigenvectors (initially complex, move them to a double matrix)
Eigen::Matrix<double, 6, 6> c_mat (f_mat * f_mat.transpose ());

Eigen::EigenSolver<Eigen::Matrix<double, 6, 6> > eigen_solver;
eigen_solver.compute (c_mat, true);
Eigen::MatrixXcd complex_eigenvectors = eigen_solver.eigenvectors ();

Eigen::Matrix<double, 6, 6> x;
for (size_t i = 0; i < 6; ++i)
for (size_t j = 0; j < 6; ++j)
x (i, j) = real (complex_eigenvectors (i, j));

const Eigen::SelfAdjointEigenSolver<Eigen::Matrix<double, 6, 6> > solver (c_mat);
const Eigen::Matrix<double, 6, 6> x = solver.eigenvectors ();

//--- Part B from the paper
/// TODO figure out how to fill the candidate_indices - see subsequent paper paragraphs
Expand Down
Loading

0 comments on commit d871977

Please sign in to comment.