@@ -54,7 +54,7 @@ pcl::search::OrganizedNeighbor<PointT>::radiusSearch (const PointT
54
54
unsigned int max_nn) const
55
55
{
56
56
// NAN test
57
- assert (isFiniteFast (query) && " Invalid (NaN, Inf) point coordinates given to nearestKSearch!" );
57
+ assert (isFinite (query) && " Invalid (NaN, Inf) point coordinates given to nearestKSearch!" );
58
58
59
59
// search window
60
60
unsigned left, right, top, bottom;
@@ -114,7 +114,7 @@ pcl::search::OrganizedNeighbor<PointT>::nearestKSearch (const PointT &query,
114
114
std::vector<int > &k_indices,
115
115
std::vector<float > &k_sqr_distances) const
116
116
{
117
- assert (isFiniteFast (query) && " Invalid (NaN, Inf) point coordinates given to nearestKSearch!" );
117
+ assert (isFinite (query) && " Invalid (NaN, Inf) point coordinates given to nearestKSearch!" );
118
118
if (k < 1 )
119
119
{
120
120
k_indices.clear ();
@@ -326,7 +326,7 @@ pcl::search::OrganizedNeighbor<PointT>::getProjectedRadiusSearchBox (const Point
326
326
template <typename PointT> template <typename MatrixType> void
327
327
pcl::search::OrganizedNeighbor<PointT>::makeSymmetric (MatrixType& matrix, bool use_upper_triangular) const
328
328
{
329
- if (use_upper_triangular)
329
+ if (use_upper_triangular && (MatrixType::Flags & Eigen::RowMajorBit) )
330
330
{
331
331
matrix.coeffRef (4 ) = matrix.coeff (1 );
332
332
matrix.coeffRef (8 ) = matrix.coeff (2 );
@@ -387,11 +387,11 @@ pcl::search::OrganizedNeighbor<PointT>::estimateProjectionMatrix ()
387
387
}
388
388
389
389
// we just want to use every 16th column and row -> skip = 2^4
390
- const unsigned int skip = input_->width >> 4 ;
391
- Eigen::Matrix<Scalar, 4 , 4 > A = Eigen::Matrix<Scalar, 4 , 4 >::Zero ();
392
- Eigen::Matrix<Scalar, 4 , 4 > B = Eigen::Matrix<Scalar, 4 , 4 >::Zero ();
393
- Eigen::Matrix<Scalar, 4 , 4 > C = Eigen::Matrix<Scalar, 4 , 4 >::Zero ();
394
- Eigen::Matrix<Scalar, 4 , 4 > D = Eigen::Matrix<Scalar, 4 , 4 >::Zero ();
390
+ const unsigned int skip = input_->width >> 3 ;
391
+ Eigen::Matrix<Scalar, 4 , 4 , Eigen::RowMajor > A = Eigen::Matrix<Scalar, 4 , 4 , Eigen::RowMajor >::Zero ();
392
+ Eigen::Matrix<Scalar, 4 , 4 , Eigen::RowMajor > B = Eigen::Matrix<Scalar, 4 , 4 , Eigen::RowMajor >::Zero ();
393
+ Eigen::Matrix<Scalar, 4 , 4 , Eigen::RowMajor > C = Eigen::Matrix<Scalar, 4 , 4 , Eigen::RowMajor >::Zero ();
394
+ Eigen::Matrix<Scalar, 4 , 4 , Eigen::RowMajor > D = Eigen::Matrix<Scalar, 4 , 4 , Eigen::RowMajor >::Zero ();
395
395
396
396
for (unsigned yIdx = 0 , idx = 0 ; yIdx < input_->height ; yIdx += skip, idx += input_->width * (skip-1 ))
397
397
{
@@ -474,7 +474,7 @@ pcl::search::OrganizedNeighbor<PointT>::estimateProjectionMatrix ()
474
474
makeSymmetric (C);
475
475
makeSymmetric (D);
476
476
477
- Eigen::Matrix<Scalar, 12 , 12 > X = Eigen::Matrix<Scalar, 12 , 12 >::Zero ();
477
+ Eigen::Matrix<Scalar, 12 , 12 , Eigen::RowMajor > X = Eigen::Matrix<Scalar, 12 , 12 , Eigen::RowMajor >::Zero ();
478
478
X.topLeftCorner <4 ,4 > () = A;
479
479
X.block <4 ,4 > (0 , 8 ) = B;
480
480
X.block <4 ,4 > (8 , 0 ) = B;
@@ -483,8 +483,8 @@ pcl::search::OrganizedNeighbor<PointT>::estimateProjectionMatrix ()
483
483
X.block <4 ,4 > (8 , 4 ) = C;
484
484
X.block <4 ,4 > (8 , 8 ) = D;
485
485
486
- Eigen::SelfAdjointEigenSolver<Eigen::Matrix<Scalar, 12 , 12 > > ei_symm (X);
487
- Eigen::Matrix<Scalar, 12 , 12 > eigen_vectors = ei_symm.eigenvectors ();
486
+ Eigen::SelfAdjointEigenSolver<Eigen::Matrix<Scalar, 12 , 12 , Eigen::RowMajor > > ei_symm (X);
487
+ Eigen::Matrix<Scalar, 12 , 12 , Eigen::RowMajor > eigen_vectors = ei_symm.eigenvectors ();
488
488
489
489
// check whether the residual MSE is low. If its high, the cloud was not captured from a projective device.
490
490
Eigen::Matrix<Scalar, 1 , 1 > residual_sqr = eigen_vectors.col (0 ).transpose () * X * eigen_vectors.col (0 );
@@ -493,6 +493,7 @@ pcl::search::OrganizedNeighbor<PointT>::estimateProjectionMatrix ()
493
493
PCL_ERROR (" [pcl::%s::radiusSearch] Input dataset is not from a projective device!\n Residual (MSE) %f, using %d valid points\n " , this ->getName ().c_str (), residual_sqr.coeff (0 ) / A.coeff (15 ), (int )A.coeff (15 ));
494
494
return ;
495
495
}
496
+
496
497
projection_matrix_.coeffRef (0 ) = eigen_vectors.coeff (0 );
497
498
projection_matrix_.coeffRef (1 ) = eigen_vectors.coeff (12 );
498
499
projection_matrix_.coeffRef (2 ) = eigen_vectors.coeff (24 );
@@ -514,7 +515,7 @@ pcl::search::OrganizedNeighbor<PointT>::estimateProjectionMatrix ()
514
515
KR_ = projection_matrix_.topLeftCorner <3 , 3 > ();
515
516
516
517
// precalculate KR * KR^T needed by calculations during nn-search
517
- KR_KRT_ = KR_ * KR_.transpose ();
518
+ KR_KRT_ = KR_ * KR_.transpose ();
518
519
}
519
520
520
521
#define PCL_INSTANTIATE_OrganizedNeighbor (T ) template class PCL_EXPORTS pcl::search::OrganizedNeighbor<T>;
0 commit comments