@@ -25,6 +25,38 @@ INSTANTIATE_TEST_SUITE_P(Feature,
25
25
FeaturePermuteDevices,
26
26
testing::ValuesIn (PermuteDevices::TestCases()));
27
27
28
+ TEST_P (FeaturePermuteDevices, SelectByIndex) {
29
+ core::Device device = GetParam ();
30
+
31
+ open3d::geometry::PointCloud pcd_legacy;
32
+ data::BunnyMesh bunny;
33
+ open3d::io::ReadPointCloud (bunny.GetPath (), pcd_legacy);
34
+
35
+ pcd_legacy.EstimateNormals ();
36
+ // Convert to float64 to avoid precision loss.
37
+ const auto pcd = t::geometry::PointCloud::FromLegacy (pcd_legacy,
38
+ core::Float64 , device);
39
+
40
+ const auto fpfh = pipelines::registration::ComputeFPFHFeature (
41
+ pcd_legacy, geometry::KDTreeSearchParamHybrid (0.01 , 100 ));
42
+ const auto fpfh_t =
43
+ t::pipelines::registration::ComputeFPFHFeature (pcd, 100 , 0.01 );
44
+
45
+ const auto selected_fpfh =
46
+ fpfh->SelectByIndex ({53 , 194 , 839 , 2543 , 6391 , 29483 }, false );
47
+ const auto selected_indeces_t =
48
+ core::TensorKey::IndexTensor (core::Tensor::Init<int64_t >(
49
+ {53 , 194 , 839 , 2543 , 6391 , 29483 }, device));
50
+ const auto selected_fpfh_t = fpfh_t .GetItem (selected_indeces_t );
51
+
52
+ EXPECT_TRUE (selected_fpfh_t .AllClose (
53
+ core::eigen_converter::EigenMatrixToTensor (selected_fpfh->data_ )
54
+ .T ()
55
+ .To (selected_fpfh_t .GetDevice (),
56
+ selected_fpfh_t .GetDtype ()),
57
+ 1e-4 , 1e-4 ));
58
+ }
59
+
28
60
TEST_P (FeaturePermuteDevices, ComputeFPFHFeature) {
29
61
core::Device device = GetParam ();
30
62
0 commit comments