Skip to content

Commit 854f412

Browse files
committed
Replace deprecated Eigen and VTK functions
- Use `canonicalEulerAngles` instead of `eulerAngles` if Eigen version is 5.0.0 or newer - Specify options as template parameters in `jacobiSvd` if Eigen version is 5.0.0 or newer - Do not call `PreserveImageExtentOn` if VTK version is 9.6.0 or newer - Use `GetCapacity` insstead of `GetSize` if VTK version is 9.7.0 or newer
1 parent da4c408 commit 854f412

File tree

7 files changed

+31
-1
lines changed

7 files changed

+31
-1
lines changed

apps/src/face_detection/filesystem_face_detection.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ run(pcl::RFFaceDetectorTrainer& fdrf,
9898
bool result = face_detection_apps_utils::readMatrixFromFile(pose_file, pose_mat);
9999

100100
if (result) {
101+
#if (EIGEN_WORLD_VERSION > 3 || (EIGEN_WORLD_VERSION == 3 && EIGEN_MAJOR_VERSION >= 5))
102+
Eigen::Vector3f ea = pose_mat.topLeftCorner<3, 3>().canonicalEulerAngles(0, 1, 2);
103+
#else
101104
Eigen::Vector3f ea = pose_mat.topLeftCorner<3, 3>().eulerAngles(0, 1, 2);
105+
#endif
102106
Eigen::Vector3f trans_vector =
103107
Eigen::Vector3f(pose_mat(0, 3), pose_mat(1, 3), pose_mat(2, 3));
104108
std::cout << ea << std::endl;

recognition/src/face_detection/face_detector_data_provider.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@ void pcl::face_detection::FaceDetectorDataProvider<FeatureType, DataSet, LabelTy
9393

9494
if (readMatrixFromFile (pose_file, pose_mat))
9595
{
96+
#if (EIGEN_WORLD_VERSION > 3 || (EIGEN_WORLD_VERSION == 3 && EIGEN_MAJOR_VERSION >= 5))
97+
Eigen::Vector3f ea = pose_mat.topLeftCorner<3, 3> ().canonicalEulerAngles (0, 1, 2);
98+
#else
9699
Eigen::Vector3f ea = pose_mat.topLeftCorner<3, 3> ().eulerAngles (0, 1, 2);
100+
#endif
97101
ea *= 57.2957795f; //transform it to degrees to do the binning
98102
int y = static_cast<int>(pcl_round ((ea[0] + static_cast<float>(std::abs (min_yaw))) / res_yaw));
99103
int p = static_cast<int>(pcl_round ((ea[1] + static_cast<float>(std::abs (min_pitch))) / res_pitch));
@@ -354,7 +358,11 @@ void pcl::face_detection::FaceDetectorDataProvider<FeatureType, DataSet, LabelTy
354358
pose_mat.setIdentity (4, 4);
355359
readMatrixFromFile (pose_file, pose_mat);
356360

361+
#if (EIGEN_WORLD_VERSION > 3 || (EIGEN_WORLD_VERSION == 3 && EIGEN_MAJOR_VERSION >= 5))
362+
Eigen::Vector3f ea = pose_mat.topLeftCorner<3, 3> ().canonicalEulerAngles (0, 1, 2);
363+
#else
357364
Eigen::Vector3f ea = pose_mat.topLeftCorner<3, 3> ().eulerAngles (0, 1, 2);
365+
#endif
358366
Eigen::Vector3f trans_vector = Eigen::Vector3f (pose_mat (0, 3), pose_mat (1, 3), pose_mat (2, 3));
359367

360368
pcl::PointXYZ center_point;

recognition/src/face_detection/rf_face_detector_trainer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,11 @@ void pcl::RFFaceDetectorTrainer::detectFaces()
519519
head_clusters_centers_[i][1] = icp_trans (1, 3);
520520
head_clusters_centers_[i][2] = icp_trans (2, 3);
521521

522+
#if (EIGEN_WORLD_VERSION > 3 || (EIGEN_WORLD_VERSION == 3 && EIGEN_MAJOR_VERSION >= 5))
523+
Eigen::Vector3f ea = icp_trans.topLeftCorner<3, 3> ().canonicalEulerAngles (0, 1, 2);
524+
#else
522525
Eigen::Vector3f ea = icp_trans.topLeftCorner<3, 3> ().eulerAngles (0, 1, 2);
526+
#endif
523527
head_clusters_rotation_[i][0] = ea[0];
524528
head_clusters_rotation_[i][1] = ea[1];
525529
head_clusters_rotation_[i][2] = ea[2];

registration/include/pcl/registration/impl/ndt.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ NormalDistributionsTransform<PointSource, PointTarget, Scalar>::computeTransform
9494
// Convert initial guess matrix to 6 element transformation vector
9595
Eigen::Matrix<double, 6, 1> transform, score_gradient;
9696
Vector3 init_translation = eig_transformation.translation();
97+
#if (EIGEN_WORLD_VERSION > 3 || (EIGEN_WORLD_VERSION == 3 && EIGEN_MAJOR_VERSION >= 5))
98+
Vector3 init_rotation = eig_transformation.rotation().canonicalEulerAngles(0, 1, 2);
99+
#else
97100
Vector3 init_rotation = eig_transformation.rotation().eulerAngles(0, 1, 2);
101+
#endif
98102
transform << init_translation.template cast<double>(),
99103
init_rotation.template cast<double>();
100104

sample_consensus/include/pcl/sample_consensus/impl/sac_model_torus.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,11 @@ pcl::SampleConsensusModelTorus<PointT, PointNT>::computeModelCoefficients(
213213
B << -d.dot(p0), -d.dot(p1), -d.dot(p2), -d.dot(p3);
214214

215215
Eigen::Matrix<float, -1, -1> sol;
216+
#if (EIGEN_WORLD_VERSION > 3 || (EIGEN_WORLD_VERSION == 3 && EIGEN_MAJOR_VERSION >= 5))
217+
sol = A.jacobiSvd<Eigen::ComputeThinU | Eigen::ComputeThinV>().solve(B);
218+
#else
216219
sol = A.jacobiSvd(Eigen::ComputeThinU | Eigen::ComputeThinV).solve(B);
220+
#endif
217221

218222
const float r_min = -sol(0);
219223
const float D = sol(1);

visualization/src/image_viewer.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ pcl::visualization::ImageViewer::ImageViewer (const std::string& window_title)
6666
{
6767
// Prepare for image flip
6868
algo_->SetInterpolationModeToCubic ();
69+
#if (VTK_MAJOR_VERSION < 9 || (VTK_MAJOR_VERSION == 9 && VTK_MINOR_VERSION < 6))
70+
// starting with VTK 9.6.0, this is a no-op and marked deprecated
6971
algo_->PreserveImageExtentOn ();
72+
#endif
7073
algo_->FlipAboutOriginOn ();
7174
algo_->SetFilteredAxis (1);
7275

visualization/src/point_picking_event.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,11 @@ pcl::visualization::PointPickingCallback::performAreaPick (vtkRenderWindowIntera
212212

213213
vtkPolyData* selected = glyph_filter->GetOutput ();
214214
vtkIdTypeArray* global_ids = vtkIdTypeArray::SafeDownCast (selected->GetPointData ()->GetArray ("Indices"));
215-
215+
#if (VTK_MAJOR_VERSION > 9 || (VTK_MAJOR_VERSION == 9 && VTK_MINOR_VERSION >= 7))
216+
if (!global_ids->GetCapacity () || !selected->GetNumberOfPoints ())
217+
#else
216218
if (!global_ids->GetSize () || !selected->GetNumberOfPoints ())
219+
#endif
217220
continue;
218221

219222
Indices actor_indices;

0 commit comments

Comments
 (0)