Skip to content

Commit

Permalink
Minor examples formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kzampog committed Jun 25, 2022
1 parent 8485952 commit d0ba7a9
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 62 deletions.
6 changes: 3 additions & 3 deletions examples/fusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,11 @@ int main(int argc, char ** argv) {

// Visualization
rgbv.setImage(rgb_img.ptr, w, h, "RGB24");
// pcdv.addObject<cilantro::PointCloudRenderable>("model", model, rp)->setPointValues(confidence);
// pcdv.addObject<cilantro::PointCloudRenderable>("model", model, rp)->setPointValues(confidence);
pcdv.addObject<cilantro::PointCloudRenderable>("model", model, rp);
pcdv.addObject<cilantro::CameraFrustumRenderable>("cam", w, h, K, cam_pose.matrix(), 0.1f, cilantro::RenderingProperties().setLineWidth(2.0f).setLineColor(1.0f,1.0f,0.0f));
// pcdv.addObject<cilantro::PointCloudRenderable>("frame", frame.transformed(cam_pose), cilantro::RenderingProperties().setOpacity(0.2f).setPointColor(0.8f, 0.8f, 0.8f).setUseLighting(false));
// pcdv.setCameraPose(cam_pose);
// pcdv.addObject<cilantro::PointCloudRenderable>("frame", frame.transformed(cam_pose), cilantro::RenderingProperties().setOpacity(0.2f).setPointColor(0.8f, 0.8f, 0.8f).setUseLighting(false));
// pcdv.setCameraPose(cam_pose);

pcdv.clearRenderArea();
rgbv.render();
Expand Down
8 changes: 4 additions & 4 deletions examples/image_point_cloud_conversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ int main(int argc, char ** argv) {

// Get point cloud from RGBD image pair
cilantro::DepthValueConverter<unsigned short,float> dc1(1000.0f);
// cloud.fromDepthImage(depth_img.ptr, dc1, w, h, K, false, true);
// cloud.fromRGBDImages(rgb_img.ptr, depth_img.ptr, dc1, w, h, K, false, true);
// cilantro::RGBDImagesToPointsColors(rgb_img.ptr, depth_img.ptr, dc1, w, h, K, cloud.points, cloud.colors, false);
// cilantro::depthImageToPointsNormals(depth_img.ptr, dc1, w, h, K, cloud.points, cloud.normals, false);
// cloud.fromDepthImage(depth_img.ptr, dc1, w, h, K, false, true);
// cloud.fromRGBDImages(rgb_img.ptr, depth_img.ptr, dc1, w, h, K, false, true);
// cilantro::RGBDImagesToPointsColors(rgb_img.ptr, depth_img.ptr, dc1, w, h, K, cloud.points, cloud.colors, false);
// cilantro::depthImageToPointsNormals(depth_img.ptr, dc1, w, h, K, cloud.points, cloud.normals, false);
cilantro::RGBDImagesToPointsNormalsColors(rgb_img.ptr, depth_img.ptr, dc1, w, h, K, cloud.points, cloud.normals, cloud.colors, false);

// Get a depth map back from the point cloud
Expand Down
1 change: 0 additions & 1 deletion examples/multidimensional_scaling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ int main(int argc, char ** argv) {
std::cout << "Embedding dimension: " << mds.getEmbeddedPoints().rows() << std::endl;

size_t dim = mds.getEmbeddedPoints().rows();
// std::cout << mds.getComputedEigenValues().transpose() << std::endl;

// Create a new cloud by re-embedding the embedded points back to 3D
cilantro::VectorSet<float,3> points_reproj(3, distances_sq.rows());
Expand Down
64 changes: 31 additions & 33 deletions examples/non_rigid_icp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ int main(int argc, char ** argv) {
cilantro::Timer timer;
timer.start();

// cilantro::SimpleCombinedMetricSparseAffineWarpFieldICP3f icp(dst.points, dst.normals, src.points, src_to_control_nn, control_points.cols(), regularization_nn);
// cilantro::SimpleCombinedMetricSparseAffineWarpFieldICP3f icp(dst.points, dst.normals, src.points, src_to_control_nn, control_points.cols(), regularization_nn);
cilantro::SimpleCombinedMetricSparseRigidWarpFieldICP3f icp(dst.points, dst.normals, src.points, src_to_control_nn, control_points.cols(), regularization_nn);

// Parameter setting
Expand All @@ -77,40 +77,38 @@ int main(int argc, char ** argv) {

timer.stop();

// // Example 2: Compute a densely supported warp field (each point has its own local transformation)
// float res = 0.005f;
// float regularization_sigma = 3.0f*res;

// // Example 2: Compute a densely supported warp field (each point has its own local transformation)
// float res = 0.005f;
// float regularization_sigma = 3.0f*res;
//
// dst.gridDownsample(res).removeInvalidData();
// src.gridDownsample(res).removeInvalidData();
//
// float max_correspondence_dist_sq = 0.04f*0.04f;
//
// std::vector<cilantro::NeighborSet<float>> regularization_nn;
// cilantro::KDTree3f(src.points).search(src.points, cilantro::KNNNeighborhoodSpecification<>(12), regularization_nn);
//
// // Perform ICP registration
// cilantro::Timer timer;
// timer.start();
//
//// cilantro::SimpleCombinedMetricDenseAffineWarpFieldICP3f icp(dst.points, dst.normals, src.points, regularization_nn);
// cilantro::SimpleCombinedMetricDenseRigidWarpFieldICP3f icp(dst.points, dst.normals, src.points, regularization_nn);
//
// // Parameter setting
// icp.correspondenceSearchEngine().setMaxDistance(max_correspondence_dist_sq);
// icp.regularizationWeightEvaluator().setSigma(regularization_sigma);
//
// icp.setMaxNumberOfIterations(15).setConvergenceTolerance(2.5e-3f);
// icp.setMaxNumberOfGaussNewtonIterations(1).setGaussNewtonConvergenceTolerance(5e-4f);
// icp.setMaxNumberOfConjugateGradientIterations(500).setConjugateGradientConvergenceTolerance(1e-5f);
// icp.setPointToPointMetricWeight(0.1f).setPointToPlaneMetricWeight(1.0f).setStiffnessRegularizationWeight(200.0f);
// icp.setHuberLossBoundary(1e-2f);
//
// auto tf_est = icp.estimate().getTransform();
//
// timer.stop();
// dst.gridDownsample(res).removeInvalidData();
// src.gridDownsample(res).removeInvalidData();

// float max_correspondence_dist_sq = 0.04f*0.04f;

// std::vector<cilantro::NeighborSet<float>> regularization_nn;
// cilantro::KDTree3f(src.points).search(src.points, cilantro::KNNNeighborhoodSpecification<>(12), regularization_nn);

// // Perform ICP registration
// cilantro::Timer timer;
// timer.start();

// // cilantro::SimpleCombinedMetricDenseAffineWarpFieldICP3f icp(dst.points, dst.normals, src.points, regularization_nn);
// cilantro::SimpleCombinedMetricDenseRigidWarpFieldICP3f icp(dst.points, dst.normals, src.points, regularization_nn);

// // Parameter setting
// icp.correspondenceSearchEngine().setMaxDistance(max_correspondence_dist_sq);
// icp.regularizationWeightEvaluator().setSigma(regularization_sigma);

// icp.setMaxNumberOfIterations(15).setConvergenceTolerance(2.5e-3f);
// icp.setMaxNumberOfGaussNewtonIterations(1).setGaussNewtonConvergenceTolerance(5e-4f);
// icp.setMaxNumberOfConjugateGradientIterations(500).setConjugateGradientConvergenceTolerance(1e-5f);
// icp.setPointToPointMetricWeight(0.1f).setPointToPlaneMetricWeight(1.0f).setStiffnessRegularizationWeight(200.0f);
// icp.setHuberLossBoundary(1e-2f);

// auto tf_est = icp.estimate().getTransform();

// timer.stop();

std::cout << "Registration time: " << timer.getElapsedTime() << "ms" << std::endl;
std::cout << "Iterations performed: " << icp.getNumberOfPerformedIterations() << std::endl;
Expand Down
38 changes: 19 additions & 19 deletions examples/rigid_icp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,30 +84,30 @@ int main(int argc, char ** argv) {
cilantro::Timer timer;
timer.start();

// // Custom examples
// // Point features adaptors for correspondence search
//// cilantro::PointNormalColorFeaturesAdaptor3f dst_feat(dst.points, dst.normals, dst.colors, 0.5, 5.0);
//// cilantro::PointNormalColorFeaturesAdaptor3f src_feat(src.points, src.normals, src.colors, 0.5, 5.0);
// cilantro::PointFeaturesAdaptor3f dst_feat(dst.points);
// cilantro::PointFeaturesAdaptor3f src_feat(src.points);
//
// cilantro::DistanceEvaluator<float> dist_eval;
// cilantro::CorrespondenceSearchKDTree<decltype(dst_feat)> corr_engine(dst_feat, src_feat, dist_eval);
//
// cilantro::UnityWeightEvaluator<float> corr_weight_eval;
//
// // Point-to-point
//// cilantro::PointToPointMetricRigidTransformICP3f<decltype(corr_engine)> icp(dst.points, src.points, corr_engine);
// // Weighted combination of point-to-point and point-to-plane
// cilantro::CombinedMetricRigidTransformICP3f<decltype(corr_engine)> icp(dst.points, dst.normals, src.points, corr_engine, corr_weight_eval, corr_weight_eval);
// // Custom examples
// // Point features adaptors for correspondence search
// // cilantro::PointNormalColorFeaturesAdaptor3f dst_feat(dst.points, dst.normals, dst.colors, 0.5, 5.0);
// // cilantro::PointNormalColorFeaturesAdaptor3f src_feat(src.points, src.normals, src.colors, 0.5, 5.0);
// cilantro::PointFeaturesAdaptor3f dst_feat(dst.points);
// cilantro::PointFeaturesAdaptor3f src_feat(src.points);

// cilantro::DistanceEvaluator<float> dist_eval;
// cilantro::CorrespondenceSearchKDTree<decltype(dst_feat)> corr_engine(dst_feat, src_feat, dist_eval);

// cilantro::UnityWeightEvaluator<float> corr_weight_eval;

// // Point-to-point
// // cilantro::PointToPointMetricRigidTransformICP3f<decltype(corr_engine)> icp(dst.points, src.points, corr_engine);
// // Weighted combination of point-to-point and point-to-plane
// cilantro::CombinedMetricRigidTransformICP3f<decltype(corr_engine)> icp(dst.points, dst.normals, src.points, corr_engine, corr_weight_eval, corr_weight_eval);

// Common instances
// Point-to-point
// cilantro::SimplePointToPointMetricRigidProjectiveICP3f icp(dst.points, src.points);
// cilantro::SimplePointToPointMetricRigidICP3f icp(dst.points, src.points);
// cilantro::SimplePointToPointMetricRigidProjectiveICP3f icp(dst.points, src.points);
// cilantro::SimplePointToPointMetricRigidICP3f icp(dst.points, src.points);

// Weighted combination of point-to-point and point-to-plane
// cilantro::SimpleCombinedMetricRigidProjectiveICP3f icp(dst.points, dst.normals, src.points);
// cilantro::SimpleCombinedMetricRigidProjectiveICP3f icp(dst.points, dst.normals, src.points);
cilantro::SimpleCombinedMetricRigidICP3f icp(dst.points, dst.normals, src.points);

// Parameter setting
Expand Down
4 changes: 2 additions & 2 deletions examples/space_region_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ int main(int argc, char ** argv) {

cilantro::SpaceRegion2f sr3(std::vector<Eigen::Vector3f>(1,Eigen::Vector3f(-1,1,-70)));

// SpaceRegion2D sr = sr1.unionWith(sr2).complement();
// SpaceRegion2D sr = sr1.unionWith(sr2).complement();
cilantro::SpaceRegion2f sr = sr1.intersectionWith(sr2.complement()).unionWith(sr2.intersectionWith(sr1.complement())).intersectionWith(sr3);
// SpaceRegion2D sr = sr2.relativeComplement(sr1);
// SpaceRegion2D sr = sr2.relativeComplement(sr1);

sr.transform(Eigen::Rotation2D<float>(-M_PI/4.0).toRotationMatrix(), Eigen::Vector2f(80,220));

Expand Down

0 comments on commit d0ba7a9

Please sign in to comment.