diff --git a/cpp/benchmarks/geometry/TriangleMesh.cpp b/cpp/benchmarks/geometry/TriangleMesh.cpp index 0b170325349..0a0c38e98b6 100644 --- a/cpp/benchmarks/geometry/TriangleMesh.cpp +++ b/cpp/benchmarks/geometry/TriangleMesh.cpp @@ -39,7 +39,7 @@ namespace registration { // TODO: Change this to pcd with non-finite poins. static void BenchmarkCreateFromPointCloudBallPivoting( benchmark::State& state, const bool remove_non_finite_points) { - data::SamplePointCloudPCD sample_pcd; + data::PCDPointCloud sample_pcd; auto pcd = io::CreatePointCloudFromFile(sample_pcd.GetPath()); if (remove_non_finite_points) { diff --git a/cpp/benchmarks/t/geometry/PointCloud.cpp b/cpp/benchmarks/t/geometry/PointCloud.cpp index 588f787f454..8e8242d278e 100644 --- a/cpp/benchmarks/t/geometry/PointCloud.cpp +++ b/cpp/benchmarks/t/geometry/PointCloud.cpp @@ -76,7 +76,7 @@ void ToLegacyPointCloud(benchmark::State& state, const core::Device& device) { } } -data::SamplePointCloudPLY pointcloud_ply; +data::PLYPointCloud pointcloud_ply; static const std::string path = pointcloud_ply.GetPath(); void LegacyVoxelDownSample(benchmark::State& state, float voxel_size) { diff --git a/cpp/benchmarks/t/io/PointCloudIO.cpp b/cpp/benchmarks/t/io/PointCloudIO.cpp index bee386ef0ed..ab118223630 100644 --- a/cpp/benchmarks/t/io/PointCloudIO.cpp +++ b/cpp/benchmarks/t/io/PointCloudIO.cpp @@ -45,7 +45,7 @@ namespace geometry { // This file is just used to load the `point cloud` data. So, format of this // file is not important. -data::SamplePointCloudPLY pointcloud_ply_data; +data::PLYPointCloud pointcloud_ply_data; static const std::string input_path_pcd = pointcloud_ply_data.GetPath(); void IOWriteLegacyPointCloud(benchmark::State& state, diff --git a/cpp/benchmarks/t/pipelines/odometry/RGBDOdometry.cpp b/cpp/benchmarks/t/pipelines/odometry/RGBDOdometry.cpp index cfb4ea51e13..955d00c0883 100644 --- a/cpp/benchmarks/t/pipelines/odometry/RGBDOdometry.cpp +++ b/cpp/benchmarks/t/pipelines/odometry/RGBDOdometry.cpp @@ -65,7 +65,7 @@ static void ComputeOdometryResultPointToPlane(benchmark::State& state, const float depth_diff = 0.07; const float depth_max = 3.0; - data::SampleRGBDDatasetRedwood redwood_data; + data::SampleRedwoodRGBDImages redwood_data; t::geometry::Image src_depth = *t::io::CreateImageFromFile(redwood_data.GetDepthPaths()[0]); t::geometry::Image dst_depth = @@ -127,7 +127,7 @@ static void RGBDOdometryMultiScale( const float depth_max = 3.0; const float depth_diff = 0.07; - data::SampleRGBDDatasetRedwood redwood_data; + data::SampleRedwoodRGBDImages redwood_data; t::geometry::Image src_depth = *t::io::CreateImageFromFile(redwood_data.GetDepthPaths()[0]); t::geometry::Image src_color = diff --git a/cpp/open3d/data/Dataset.cpp b/cpp/open3d/data/Dataset.cpp index 276294900d2..a637c85230a 100644 --- a/cpp/open3d/data/Dataset.cpp +++ b/cpp/open3d/data/Dataset.cpp @@ -90,10 +90,9 @@ SingleDownloadDataset::SingleDownloadDataset( } } -DemoICPPointClouds::DemoICPPointClouds(const std::string& prefix, - const std::string& data_root) +DemoICPPointClouds::DemoICPPointClouds(const std::string& data_root) : SingleDownloadDataset( - prefix, + "DemoICPPointClouds", {"https://github.com/isl-org/open3d_downloads/releases/download/" "20220201-data/DemoICPPointClouds.zip"}, "76cf67ab1af942e3c4d5e97b9c2ae58f", @@ -115,9 +114,9 @@ std::string DemoICPPointClouds::GetPaths(size_t index) const { } DemoColoredICPPointClouds::DemoColoredICPPointClouds( - const std::string& prefix, const std::string& data_root) + const std::string& data_root) : SingleDownloadDataset( - prefix, + "DemoColoredICPPointClouds", {"https://github.com/isl-org/open3d_downloads/releases/download/" "20220201-data/DemoColoredICPPointClouds.zip"}, "bf8d469e892d76f2e69e1213207c0e30", @@ -136,32 +135,31 @@ std::string DemoColoredICPPointClouds::GetPaths(size_t index) const { return paths_[index]; } -DemoCropPointCloud::DemoCropPointCloud(const std::string& prefix, - const std::string& data_root) +DemoCropPointCloud::DemoCropPointCloud(const std::string& data_root) : SingleDownloadDataset( - prefix, + "DemoCropPointCloud", {"https://github.com/isl-org/open3d_downloads/releases/download/" "20220201-data/DemoCropPointCloud.zip"}, "12dbcdddd3f0865d8312929506135e23", /*no_extract =*/false, data_root) { const std::string extract_dir = Dataset::GetExtractDir(); - pointcloud_path_ = extract_dir + "/fragment.ply"; + point_cloud_path_ = extract_dir + "/fragment.ply"; cropped_json_path_ = extract_dir + "/cropped.json"; } -DemoPointCloudFeatureMatching::DemoPointCloudFeatureMatching( - const std::string& prefix, const std::string& data_root) +DemoFeatureMatchingPointClouds::DemoFeatureMatchingPointClouds( + const std::string& data_root) : SingleDownloadDataset( - prefix, + "DemoFeatureMatchingPointClouds", {"https://github.com/isl-org/open3d_downloads/releases/download/" - "20220201-data/DemoPointCloudFeatureMatching.zip"}, + "20220201-data/DemoFeatureMatchingPointClouds.zip"}, "02f0703ce0cbf4df78ce2602ae33fc79", /*no_extract =*/false, data_root) { const std::string extract_dir = Dataset::GetExtractDir(); - pointcloud_paths_ = {extract_dir + "/cloud_bin_0.pcd", - extract_dir + "/cloud_bin_1.pcd"}; + point_cloud_paths_ = {extract_dir + "/cloud_bin_0.pcd", + extract_dir + "/cloud_bin_1.pcd"}; fpfh_feature_paths_ = {extract_dir + "/cloud_bin_0.fpfh.bin", extract_dir + "/cloud_bin_1.fpfh.bin"}; l32d_feature_paths_ = {extract_dir + "/cloud_bin_0.d32.bin", @@ -169,9 +167,9 @@ DemoPointCloudFeatureMatching::DemoPointCloudFeatureMatching( } DemoPoseGraphOptimization::DemoPoseGraphOptimization( - const std::string& prefix, const std::string& data_root) + const std::string& data_root) : SingleDownloadDataset( - prefix, + "DemoPoseGraphOptimization", {"https://github.com/isl-org/open3d_downloads/releases/download/" "20220201-data/DemoPoseGraphOptimization.zip"}, "af085b28d79dea7f0a50aef50c96b62c", @@ -183,10 +181,9 @@ DemoPoseGraphOptimization::DemoPoseGraphOptimization( pose_graph_global_path_ = extract_dir + "/pose_graph_example_global.json"; } -SamplePointCloudPCD::SamplePointCloudPCD(const std::string& prefix, - const std::string& data_root) +PCDPointCloud::PCDPointCloud(const std::string& data_root) : SingleDownloadDataset( - prefix, + "PCDPointCloud", {"https://github.com/isl-org/open3d_downloads/releases/" "download/20220201-data/fragment.pcd"}, "f3a613fd2bdecd699aabdd858fb29606", @@ -195,10 +192,9 @@ SamplePointCloudPCD::SamplePointCloudPCD(const std::string& prefix, path_ = Dataset::GetExtractDir() + "/fragment.pcd"; } -SamplePointCloudPLY::SamplePointCloudPLY(const std::string& prefix, - const std::string& data_root) +PLYPointCloud::PLYPointCloud(const std::string& data_root) : SingleDownloadDataset( - prefix, + "PLYPointCloud", {"https://github.com/isl-org/open3d_downloads/releases/" "download/20220201-data/fragment.ply"}, "831ecffd4d7cbbbe02494c5c351aa6e5", @@ -207,12 +203,11 @@ SamplePointCloudPLY::SamplePointCloudPLY(const std::string& prefix, path_ = Dataset::GetExtractDir() + "/fragment.ply"; } -SampleRGBDImageNYU::SampleRGBDImageNYU(const std::string& prefix, - const std::string& data_root) +SampleNYURGBDImage::SampleNYURGBDImage(const std::string& data_root) : SingleDownloadDataset( - prefix, + "SampleNYURGBDImage", {"https://github.com/isl-org/open3d_downloads/releases/download/" - "20220201-data/SampleRGBDImageNYU.zip"}, + "20220201-data/SampleNYURGBDImage.zip"}, "b0baaf892c7ff9b202eb5fb40c5f7b58", /*no_extract =*/false, data_root) { @@ -220,12 +215,11 @@ SampleRGBDImageNYU::SampleRGBDImageNYU(const std::string& prefix, depth_path_ = Dataset::GetExtractDir() + "/NYU_depth.pgm"; } -SampleRGBDImageSUN::SampleRGBDImageSUN(const std::string& prefix, - const std::string& data_root) +SampleSUNRGBDImage::SampleSUNRGBDImage(const std::string& data_root) : SingleDownloadDataset( - prefix, + "SampleSUNRGBDImage", {"https://github.com/isl-org/open3d_downloads/releases/download/" - "20220201-data/SampleRGBDImageSUN.zip"}, + "20220201-data/SampleSUNRGBDImage.zip"}, "b1a430586547c8986bdf8b36179a8e67", /*no_extract =*/false, data_root) { @@ -233,12 +227,11 @@ SampleRGBDImageSUN::SampleRGBDImageSUN(const std::string& prefix, depth_path_ = Dataset::GetExtractDir() + "/SUN_depth.png"; } -SampleRGBDImageTUM::SampleRGBDImageTUM(const std::string& prefix, - const std::string& data_root) +SampleTUMRGBDImage::SampleTUMRGBDImage(const std::string& data_root) : SingleDownloadDataset( - prefix, + "SampleTUMRGBDImage", {"https://github.com/isl-org/open3d_downloads/releases/download/" - "20220201-data/SampleRGBDImageTUM.zip"}, + "20220201-data/SampleTUMRGBDImage.zip"}, "91758d42b142dbad7b0d90e857ad47a8", /*no_extract =*/false, data_root) { @@ -246,12 +239,11 @@ SampleRGBDImageTUM::SampleRGBDImageTUM(const std::string& prefix, depth_path_ = Dataset::GetExtractDir() + "/TUM_depth.png"; } -SampleRGBDDatasetRedwood::SampleRGBDDatasetRedwood(const std::string& prefix, - const std::string& data_root) +SampleRedwoodRGBDImages::SampleRedwoodRGBDImages(const std::string& data_root) : SingleDownloadDataset( - prefix, + "SampleRedwoodRGBDImages", {"https://github.com/isl-org/open3d_downloads/releases/download/" - "20220201-data/SampleRGBDDatasetRedwood.zip"}, + "20220201-data/SampleRedwoodRGBDImages.zip"}, "3af3b6ee53e4d64396537553995d9556", /*no_extract =*/false, data_root) { @@ -273,12 +265,11 @@ SampleRGBDDatasetRedwood::SampleRGBDDatasetRedwood(const std::string& prefix, reconstruction_path_ = extract_dir + "/example_tsdf_pcd.ply"; } -SampleFountainRGBDDataset::SampleFountainRGBDDataset( - const std::string& prefix, const std::string& data_root) +SampleFountainRGBDImages::SampleFountainRGBDImages(const std::string& data_root) : SingleDownloadDataset( - prefix, + "SampleFountainRGBDImages", {"https://github.com/isl-org/open3d_downloads/releases/download/" - "20220201-data/SampleFountainRGBDDataset.zip"}, + "20220201-data/SampleFountainRGBDImages.zip"}, "c6c1b2171099f571e2a78d78675df350", /*no_extract =*/false, data_root) { @@ -355,10 +346,9 @@ SampleFountainRGBDDataset::SampleFountainRGBDDataset( reconstruction_path_ = extract_dir + "/scene/integrated.ply"; } -EaglePointCloud::EaglePointCloud(const std::string& prefix, - const std::string& data_root) +EaglePointCloud::EaglePointCloud(const std::string& data_root) : SingleDownloadDataset( - prefix, + "EaglePointCloud", {"https://github.com/isl-org/open3d_downloads/releases/download/" "20220201-data/EaglePointCloud.ply"}, "e4e6c77bc548e7eb7548542a0220ad78", @@ -367,10 +357,9 @@ EaglePointCloud::EaglePointCloud(const std::string& prefix, path_ = Dataset::GetExtractDir() + "/EaglePointCloud.ply"; } -ArmadilloMesh::ArmadilloMesh(const std::string& prefix, - const std::string& data_root) +ArmadilloMesh::ArmadilloMesh(const std::string& data_root) : SingleDownloadDataset( - prefix, + "ArmadilloMesh", {"https://github.com/isl-org/open3d_downloads/releases/download/" "20220201-data/ArmadilloMesh.ply"}, "9e68ff1b1cc914ed88cd84f6a8235021", @@ -379,9 +368,9 @@ ArmadilloMesh::ArmadilloMesh(const std::string& prefix, path_ = Dataset::GetExtractDir() + "/ArmadilloMesh.ply"; } -BunnyMesh::BunnyMesh(const std::string& prefix, const std::string& data_root) +BunnyMesh::BunnyMesh(const std::string& data_root) : SingleDownloadDataset( - prefix, + "BunnyMesh", {"https://github.com/isl-org/open3d_downloads/releases/download/" "20220201-data/BunnyMesh.ply"}, "568f871d1a221ba6627569f1e6f9a3f2", @@ -390,9 +379,9 @@ BunnyMesh::BunnyMesh(const std::string& prefix, const std::string& data_root) path_ = Dataset::GetExtractDir() + "/BunnyMesh.ply"; } -KnotMesh::KnotMesh(const std::string& prefix, const std::string& data_root) +KnotMesh::KnotMesh(const std::string& data_root) : SingleDownloadDataset( - prefix, + "KnotMesh", {"https://github.com/isl-org/open3d_downloads/releases/download/" "20220201-data/KnotMesh.ply"}, "bfc9f132ecdfb7f9fdc42abf620170fc", @@ -401,10 +390,9 @@ KnotMesh::KnotMesh(const std::string& prefix, const std::string& data_root) path_ = Dataset::GetExtractDir() + "/KnotMesh.ply"; } -JuneauImage::JuneauImage(const std::string& prefix, - const std::string& data_root) +JuneauImage::JuneauImage(const std::string& data_root) : SingleDownloadDataset( - prefix, + "JuneauImage", {"https://github.com/isl-org/open3d_downloads/releases/download/" "20220201-data/JuneauImage.jpg"}, "a090f6342893bdf0caefd83c6debbecd", @@ -413,10 +401,9 @@ JuneauImage::JuneauImage(const std::string& prefix, path_ = Dataset::GetExtractDir() + "/JuneauImage.jpg"; } -RedwoodLivingRoomPointClouds::RedwoodLivingRoomPointClouds( - const std::string& prefix, const std::string& data_root) +LivingRoomPointClouds::LivingRoomPointClouds(const std::string& data_root) : SingleDownloadDataset( - prefix, + "LivingRoomPointClouds", {"http://redwood-data.org/indoor/data/" "livingroom1-fragments-ply.zip", "https://github.com/isl-org/open3d_downloads/releases/" @@ -431,7 +418,7 @@ RedwoodLivingRoomPointClouds::RedwoodLivingRoomPointClouds( } } -std::string RedwoodLivingRoomPointClouds::GetPaths(size_t index) const { +std::string LivingRoomPointClouds::GetPaths(size_t index) const { if (index > 56) { utility::LogError( "Invalid index. Expected index between 0 to 56 but got {}.", @@ -440,10 +427,9 @@ std::string RedwoodLivingRoomPointClouds::GetPaths(size_t index) const { return paths_[index]; } -RedwoodOfficePointClouds::RedwoodOfficePointClouds(const std::string& prefix, - const std::string& data_root) +OfficePointClouds::OfficePointClouds(const std::string& data_root) : SingleDownloadDataset( - prefix, + "OfficePointClouds", {"http://redwood-data.org/indoor/data/" "office1-fragments-ply.zip", "https://github.com/isl-org/open3d_downloads/releases/" @@ -458,7 +444,7 @@ RedwoodOfficePointClouds::RedwoodOfficePointClouds(const std::string& prefix, } } -std::string RedwoodOfficePointClouds::GetPaths(size_t index) const { +std::string OfficePointClouds::GetPaths(size_t index) const { if (index > 52) { utility::LogError( "Invalid index. Expected index between 0 to 52 but got {}.", diff --git a/cpp/open3d/data/Dataset.h b/cpp/open3d/data/Dataset.h index 0404e39670a..7c34032669f 100644 --- a/cpp/open3d/data/Dataset.h +++ b/cpp/open3d/data/Dataset.h @@ -128,8 +128,7 @@ class SingleDownloadDataset : public Dataset { /// \copyright Creative Commons 3.0 (CC BY 3.0). class DemoICPPointClouds : public SingleDownloadDataset { public: - DemoICPPointClouds(const std::string& prefix = "DemoICPPointClouds", - const std::string& data_root = ""); + DemoICPPointClouds(const std::string& data_root = ""); /// \brief Returns list of 3 point cloud paths. std::vector GetPaths() const { return paths_; } @@ -149,9 +148,7 @@ class DemoICPPointClouds : public SingleDownloadDataset { /// \copyright Creative Commons 3.0 (CC BY 3.0). class DemoColoredICPPointClouds : public SingleDownloadDataset { public: - DemoColoredICPPointClouds( - const std::string& prefix = "DemoColoredICPPointClouds", - const std::string& data_root = ""); + DemoColoredICPPointClouds(const std::string& data_root = ""); /// \brief Returns list of list of 2 point cloud paths. std::vector GetPaths() const { return paths_; } @@ -171,35 +168,32 @@ class DemoColoredICPPointClouds : public SingleDownloadDataset { /// \copyright Creative Commons 3.0 (CC BY 3.0). class DemoCropPointCloud : public SingleDownloadDataset { public: - DemoCropPointCloud(const std::string& prefix = "DemoCropPointCloud", - const std::string& data_root = ""); + DemoCropPointCloud(const std::string& data_root = ""); /// \brief Returns path to example point cloud. - std::string GetPointCloudPath() const { return pointcloud_path_; } + std::string GetPointCloudPath() const { return point_cloud_path_; } /// \brief Returns path to saved selected polygon volume file. std::string GetCroppedJSONPath() const { return cropped_json_path_; } private: // Path to example point cloud. - std::string pointcloud_path_; + std::string point_cloud_path_; // Path to saved selected polygon volume file. std::string cropped_json_path_; }; -/// \class DemoPointCloudFeatureMatching -/// \brief Data class for `DemoPointCloudFeatureMatching` contains 2 +/// \class DemoFeatureMatchingPointClouds +/// \brief Data class for `DemoFeatureMatchingPointClouds` contains 2 /// pointcloud fragments and their respective FPFH features and L32D features. /// This data is used in Open3D for point cloud feature matching demo. /// \copyright Creative Commons 3.0 (CC BY 3.0). -class DemoPointCloudFeatureMatching : public SingleDownloadDataset { +class DemoFeatureMatchingPointClouds : public SingleDownloadDataset { public: - DemoPointCloudFeatureMatching( - const std::string& prefix = "DemoPointCloudFeatureMatching", - const std::string& data_root = ""); + DemoFeatureMatchingPointClouds(const std::string& data_root = ""); /// \brief Returns list of paths to point clouds, of size 2. std::vector GetPointCloudPaths() const { - return pointcloud_paths_; + return point_cloud_paths_; } /// \brief Returns list of paths to saved FPFH features binary for point /// clouds, respectively, of size 2. @@ -214,7 +208,7 @@ class DemoPointCloudFeatureMatching : public SingleDownloadDataset { private: /// List of paths to point clouds, of size 2. - std::vector pointcloud_paths_; + std::vector point_cloud_paths_; /// List of saved FPFH features binary for point clouds, /// respectively, of size 2. std::vector fpfh_feature_paths_; @@ -229,9 +223,7 @@ class DemoPointCloudFeatureMatching : public SingleDownloadDataset { /// for pose graph optimization demo. class DemoPoseGraphOptimization : public SingleDownloadDataset { public: - DemoPoseGraphOptimization( - const std::string& prefix = "DemoPoseGraphOptimization", - const std::string& data_root = ""); + DemoPoseGraphOptimization(const std::string& data_root = ""); /// \brief Returns path to example global pose graph (json). std::string GetPoseGraphFragmentPath() const { @@ -249,13 +241,12 @@ class DemoPoseGraphOptimization : public SingleDownloadDataset { std::string pose_graph_global_path_; }; -/// \class SamplePointCloudPCD -/// \brief Data class for `SamplePointCloudPCD` contains the `fragment.pcd` +/// \class PCDPointCloud +/// \brief Data class for `PCDPointCloud` contains the `fragment.pcd` /// point cloud mesh from the `Redwood Living Room` dataset. -class SamplePointCloudPCD : public SingleDownloadDataset { +class PCDPointCloud : public SingleDownloadDataset { public: - SamplePointCloudPCD(const std::string& prefix = "SamplePointCloudPCD", - const std::string& data_root = ""); + PCDPointCloud(const std::string& data_root = ""); /// \brief Returns path to the `pcd` format point cloud. std::string GetPath() const { return path_; }; @@ -265,13 +256,12 @@ class SamplePointCloudPCD : public SingleDownloadDataset { std::string path_; }; -/// \class SamplePointCloudPLY -/// \brief Data class for `SamplePointCloudPLY` contains the `fragment.ply` +/// \class PLYPointCloud +/// \brief Data class for `PLYPointCloud` contains the `fragment.ply` /// point cloud mesh from the `Redwood Living Room` dataset. -class SamplePointCloudPLY : public SingleDownloadDataset { +class PLYPointCloud : public SingleDownloadDataset { public: - SamplePointCloudPLY(const std::string& prefix = "SamplePointCloudPLY", - const std::string& data_root = ""); + PLYPointCloud(const std::string& data_root = ""); /// \brief Returns path to the PLY format point cloud. std::string GetPath() const { return path_; }; @@ -281,14 +271,13 @@ class SamplePointCloudPLY : public SingleDownloadDataset { std::string path_; }; -/// \class SampleRGBDImageNYU -/// \brief Data class for `SampleRGBDImageNYU` contains a color image +/// \class SampleNYURGBDImage +/// \brief Data class for `SampleNYURGBDImage` contains a color image /// `NYU_color.ppm` and a depth image `NYU_depth.pgm` sample from NYU RGBD /// dataset. -class SampleRGBDImageNYU : public SingleDownloadDataset { +class SampleNYURGBDImage : public SingleDownloadDataset { public: - SampleRGBDImageNYU(const std::string& prefix = "SampleRGBDImageNYU", - const std::string& data_root = ""); + SampleNYURGBDImage(const std::string& data_root = ""); /// \brief Returns path to color image sample. std::string GetColorPath() const { return color_path_; }; @@ -302,14 +291,13 @@ class SampleRGBDImageNYU : public SingleDownloadDataset { std::string depth_path_; }; -/// \class SampleRGBDImageSUN -/// \brief Data class for `SampleRGBDImageSUN` contains a color image +/// \class SampleSUNRGBDImage +/// \brief Data class for `SampleSUNRGBDImage` contains a color image /// `SUN_color.jpg` and a depth image `SUN_depth.png` sample from SUN RGBD /// dataset. -class SampleRGBDImageSUN : public SingleDownloadDataset { +class SampleSUNRGBDImage : public SingleDownloadDataset { public: - SampleRGBDImageSUN(const std::string& prefix = "SampleRGBDImageSUN", - const std::string& data_root = ""); + SampleSUNRGBDImage(const std::string& data_root = ""); /// \brief Returns path to color image sample. std::string GetColorPath() const { return color_path_; }; @@ -323,14 +311,13 @@ class SampleRGBDImageSUN : public SingleDownloadDataset { std::string depth_path_; }; -/// \class SampleRGBDImageTUM -/// \brief Data class for `SampleRGBDImageTUM` contains a color image +/// \class SampleTUMRGBDImage +/// \brief Data class for `SampleTUMRGBDImage` contains a color image /// `TUM_color.png` and a depth image `TUM_depth.png` sample from TUM RGBD /// dataset. -class SampleRGBDImageTUM : public SingleDownloadDataset { +class SampleTUMRGBDImage : public SingleDownloadDataset { public: - SampleRGBDImageTUM(const std::string& prefix = "SampleRGBDImageTUM", - const std::string& data_root = ""); + SampleTUMRGBDImage(const std::string& data_root = ""); /// \brief Returns path to color image sample. std::string GetColorPath() const { return color_path_; }; @@ -344,16 +331,14 @@ class SampleRGBDImageTUM : public SingleDownloadDataset { std::string depth_path_; }; -/// \class SampleRGBDDatasetRedwood -/// \brief Data class for `SampleRGBDDatasetICL` contains a sample set of 5 +/// \class SampleRedwoodRGBDImages +/// \brief Data class for `SampleRedwoodRGBDImages` contains a sample set of 5 /// color and depth images from Redwood RGBD dataset living-room1. -/// Additionally it also contains camera trajectory log, camera odometry log, -/// RGBD match, and point cloud reconstruction from TSDF. -class SampleRGBDDatasetRedwood : public SingleDownloadDataset { +// Additionally it also contains camera trajectory log, camera odometry log, +// rgbd match, and point cloud reconstruction obtained using TSDF. +class SampleRedwoodRGBDImages : public SingleDownloadDataset { public: - SampleRGBDDatasetRedwood( - const std::string& prefix = "SampleRGBDDatasetRedwood", - const std::string& data_root = ""); + SampleRedwoodRGBDImages(const std::string& data_root = ""); /// \brief Returns List of paths to color image samples of size 5. std::vector GetColorPaths() const { return color_paths_; }; @@ -362,7 +347,7 @@ class SampleRGBDDatasetRedwood : public SingleDownloadDataset { /// \brief Returns path to camera trajectory log file `trajectory.log`. std::string GetTrajectoryLogPath() const { return trajectory_log_path_; }; - /// \brief Returns path to camera trajectory log file `trajectory.log`. + /// \brief Returns path to camera trajectory log file `odometry.log`. std::string GetOdometryLogPath() const { return odometry_log_path_; }; /// \brief Returns path to color and depth image match file `rgbd.match`. std::string GetRGBDMatchPath() const { return rgbd_match_path_; }; @@ -385,14 +370,12 @@ class SampleRGBDDatasetRedwood : public SingleDownloadDataset { std::string reconstruction_path_; }; -/// \class SampleFountainRGBDDataset -/// \brief Data class for `SampleFountainRGBDDataset` contains a sample set of +/// \class SampleFountainRGBDImages +/// \brief Data class for `SampleFountainRGBDImages` contains a sample set of /// 33 color and depth images from the `Fountain RGBD dataset`. -class SampleFountainRGBDDataset : public SingleDownloadDataset { +class SampleFountainRGBDImages : public SingleDownloadDataset { public: - SampleFountainRGBDDataset( - const std::string& prefix = "SampleFountainRGBDDataset", - const std::string& data_root = ""); + SampleFountainRGBDImages(const std::string& data_root = ""); /// \brief Returns List of paths to color image samples of size 33. std::vector GetColorPaths() const { return color_paths_; }; @@ -417,8 +400,7 @@ class SampleFountainRGBDDataset : public SingleDownloadDataset { /// file. class EaglePointCloud : public SingleDownloadDataset { public: - EaglePointCloud(const std::string& prefix = "EaglePointCloud", - const std::string& data_root = ""); + EaglePointCloud(const std::string& data_root = ""); /// \brief Returns path to the `EaglePointCloud.ply` file. std::string GetPath() const { return path_; }; @@ -433,8 +415,7 @@ class EaglePointCloud : public SingleDownloadDataset { /// the `Stanford 3D Scanning Repository`. class ArmadilloMesh : public SingleDownloadDataset { public: - ArmadilloMesh(const std::string& prefix = "ArmadilloMesh", - const std::string& data_root = ""); + ArmadilloMesh(const std::string& data_root = ""); /// \brief Returns path to the `ArmadilloMesh.ply` file. std::string GetPath() const { return path_; }; @@ -449,8 +430,7 @@ class ArmadilloMesh : public SingleDownloadDataset { /// `Stanford 3D Scanning Repository`. class BunnyMesh : public SingleDownloadDataset { public: - BunnyMesh(const std::string& prefix = "BunnyMesh", - const std::string& data_root = ""); + BunnyMesh(const std::string& data_root = ""); /// \brief Returns path to the `BunnyMesh.ply` file. std::string GetPath() const { return path_; }; @@ -464,8 +444,7 @@ class BunnyMesh : public SingleDownloadDataset { /// \brief Data class for `KnotMesh` contains the `KnotMesh.ply` file. class KnotMesh : public SingleDownloadDataset { public: - KnotMesh(const std::string& prefix = "KnotMesh", - const std::string& data_root = ""); + KnotMesh(const std::string& data_root = ""); /// \brief Returns path to the `KnotMesh.ply` file. std::string GetPath() const { return path_; }; @@ -479,8 +458,7 @@ class KnotMesh : public SingleDownloadDataset { /// \brief Data class for `JuneauImage` contains the `JuneauImage.jpg` file. class JuneauImage : public SingleDownloadDataset { public: - JuneauImage(const std::string& prefix = "JuneauImage", - const std::string& data_root = ""); + JuneauImage(const std::string& data_root = ""); /// \brief Returns path to the `JuneauImage.jgp` file. std::string GetPath() const { return path_; }; @@ -490,15 +468,13 @@ class JuneauImage : public SingleDownloadDataset { std::string path_; }; -/// \class RedwoodLivingRoomPointClouds -/// \brief Dataset class for `RedwoodLivingRoomPointClouds` contains 57 point +/// \class LivingRoomPointClouds +/// \brief Dataset class for `LivingRoomPointClouds` contains 57 point /// clouds of binary PLY format. /// \copyright Creative Commons 3.0 (CC BY 3.0). -class RedwoodLivingRoomPointClouds : public SingleDownloadDataset { +class LivingRoomPointClouds : public SingleDownloadDataset { public: - RedwoodLivingRoomPointClouds( - const std::string& prefix = "RedwoodLivingRoomPointClouds", - const std::string& data_root = ""); + LivingRoomPointClouds(const std::string& data_root = ""); /// \brief Returns list of paths to ply point-cloud fragments of size 57. std::vector GetPaths() const { return paths_; } @@ -512,15 +488,13 @@ class RedwoodLivingRoomPointClouds : public SingleDownloadDataset { std::vector paths_; }; -/// \class RedwoodOfficePointClouds -/// \brief Dataset class for `RedwoodOfficePointClouds` contains 53 point clouds +/// \class OfficePointClouds +/// \brief Dataset class for `OfficePointClouds` contains 53 point clouds /// of binary PLY format. /// \copyright Creative Commons 3.0 (CC BY 3.0). -class RedwoodOfficePointClouds : public SingleDownloadDataset { +class OfficePointClouds : public SingleDownloadDataset { public: - RedwoodOfficePointClouds( - const std::string& prefix = "RedwoodOfficePointClouds", - const std::string& data_root = ""); + OfficePointClouds(const std::string& data_root = ""); /// \brief Returns list of paths to ply point-cloud fragments of size 52. std::vector GetPaths() const { return paths_; } diff --git a/cpp/pybind/data/data.cpp b/cpp/pybind/data/data.cpp index 9adc3fda05d..c21bce7e572 100644 --- a/cpp/pybind/data/data.cpp +++ b/cpp/pybind/data/data.cpp @@ -92,9 +92,7 @@ void pybind_demo_icp_pointclouds(py::module& m) { "Data class for `DemoICPPointClouds` contains " "3 point clouds of binary PCD format. This " "dataset is used in Open3D for ICP demo."); - demo_icp_pointclouds - .def(py::init(), - "prefix"_a = "DemoICPPointClouds", "data_root"_a = "") + demo_icp_pointclouds.def(py::init(), "data_root"_a = "") .def_property_readonly( "paths", [](const DemoICPPointClouds& demo_icp_pointclouds) { @@ -117,8 +115,7 @@ void pybind_demo_colored_icp_pointclouds(py::module& m) { "2 point clouds of `ply` format. This dataset is used in " "Open3D for colored ICP demo."); demo_colored_icp_pointclouds - .def(py::init(), - "prefix"_a = "DemoColoredICPPointClouds", "data_root"_a = "") + .def(py::init(), "data_root"_a = "") .def_property_readonly( "paths", [](const DemoColoredICPPointClouds& @@ -140,59 +137,57 @@ void pybind_demo_crop_pointcloud(py::module& m) { "cloud, and `cropped.json` (a saved selected polygon " "volume file). This dataset is used in Open3D for point " "cloud crop demo."); - demo_crop_pointcloud - .def(py::init(), - "prefix"_a = "DemoCropPointCloud", "data_root"_a = "") - .def_property_readonly("pointcloud_path", + demo_crop_pointcloud.def(py::init(), "data_root"_a = "") + .def_property_readonly("point_cloud_path", &DemoCropPointCloud::GetPointCloudPath, "Path to the example point cloud.") .def_property_readonly( "cropped_json_path", &DemoCropPointCloud::GetCroppedJSONPath, "Path to the saved selected polygon volume file."); - docstring::ClassMethodDocInject(m, "DemoCropPointCloud", "pointcloud_path"); + docstring::ClassMethodDocInject(m, "DemoCropPointCloud", + "point_cloud_path"); docstring::ClassMethodDocInject(m, "DemoCropPointCloud", "cropped_json_path"); } -void pybind_demo_pointcloud_feature_matching(py::module& m) { - // open3d.data.DemoPointCloudFeatureMatching - py::class_, - std::shared_ptr, +void pybind_demo_feature_matching_point_clouds(py::module& m) { + // open3d.data.DemoFeatureMatchingPointClouds + py::class_, + std::shared_ptr, SingleDownloadDataset> demo_feature_matching( - m, "DemoPointCloudFeatureMatching", - "Data class for `DemoPointCloudFeatureMatching` contains 2 " + m, "DemoFeatureMatchingPointClouds", + "Data class for `DemoFeatureMatchingPointClouds` contains " + "2 " "pointcloud fragments and their respective FPFH features " "and L32D features. This dataset is used in Open3D for " "point cloud feature matching demo."); demo_feature_matching - .def(py::init(), - "prefix"_a = "DemoPointCloudFeatureMatching", - "data_root"_a = "") + .def(py::init(), "data_root"_a = "") .def_property_readonly( - "pointcloud_paths", - &DemoPointCloudFeatureMatching::GetPointCloudPaths, - "List of 2 point cloud paths. Use `pointcloud_paths[0]`, " - "and `pointcloud_paths[1]`, to access the paths.") + "point_cloud_paths", + &DemoFeatureMatchingPointClouds::GetPointCloudPaths, + "List of 2 point cloud paths. Use `point_cloud_paths[0]`, " + "and `point_cloud_paths[1]`, to access the paths.") .def_property_readonly( "fpfh_feature_paths", - &DemoPointCloudFeatureMatching::GetFPFHFeaturePaths, + &DemoFeatureMatchingPointClouds::GetFPFHFeaturePaths, "List of 2 saved FPFH feature binary of the respective " "point cloud paths. Use `fpfh_feature_paths[0]`, " "and `fpfh_feature_paths[1]`, to access the paths.") .def_property_readonly( "l32d_feature_paths", - &DemoPointCloudFeatureMatching::GetL32DFeaturePaths, + &DemoFeatureMatchingPointClouds::GetL32DFeaturePaths, "List of 2 saved L32D feature binary of the respective " "point cloud paths. Use `l32d_feature_paths[0]`, " "and `l32d_feature_paths[1]`, to access the paths."); - docstring::ClassMethodDocInject(m, "DemoPointCloudFeatureMatching", - "pointcloud_paths"); - docstring::ClassMethodDocInject(m, "DemoPointCloudFeatureMatching", + docstring::ClassMethodDocInject(m, "DemoFeatureMatchingPointClouds", + "point_cloud_paths"); + docstring::ClassMethodDocInject(m, "DemoFeatureMatchingPointClouds", "fpfh_feature_paths"); - docstring::ClassMethodDocInject(m, "DemoPointCloudFeatureMatching", + docstring::ClassMethodDocInject(m, "DemoFeatureMatchingPointClouds", "l32d_feature_paths"); } @@ -209,8 +204,7 @@ void pybind_demo_pose_graph_optimization(py::module& m) { "dataset is used in Open3D for pose graph optimization " "demo."); demo_pose_graph_optimization - .def(py::init(), - "prefix"_a = "DemoPoseGraphOptimization", "data_root"_a = "") + .def(py::init(), "data_root"_a = "") .def_property_readonly( "pose_graph_fragment_path", &DemoPoseGraphOptimization::GetPoseGraphFragmentPath, @@ -225,197 +219,183 @@ void pybind_demo_pose_graph_optimization(py::module& m) { "pose_graph_global_path"); } -void pybind_sample_pointcloud_pcd(py::module& m) { - // open3d.data.SamplePointCloudPCD - py::class_, - std::shared_ptr, SingleDownloadDataset> - pcd_pointcloud(m, "SamplePointCloudPCD", - "Data class for `SamplePointCloudPCD` contains the " +void pybind_pcd_point_cloud(py::module& m) { + // open3d.data.PCDPointCloud + py::class_, + std::shared_ptr, SingleDownloadDataset> + pcd_pointcloud(m, "PCDPointCloud", + "Data class for `PCDPointCloud` contains the " "`fragment.pcd` point cloud mesh from the `Redwood " "Living Room` dataset."); - pcd_pointcloud - .def(py::init(), - "prefix"_a = "SamplePointCloudPCD", "data_root"_a = "") - .def_property_readonly("path", &SamplePointCloudPCD::GetPath, + pcd_pointcloud.def(py::init(), "data_root"_a = "") + .def_property_readonly("path", &PCDPointCloud::GetPath, "Path to the `pcd` format point cloud."); - docstring::ClassMethodDocInject(m, "SamplePointCloudPCD", "path"); + docstring::ClassMethodDocInject(m, "PCDPointCloud", "path"); } -void pybind_sample_pointcloud_ply(py::module& m) { - // open3d.data.SamplePointCloudPLY - py::class_, - std::shared_ptr, SingleDownloadDataset> - ply_pointcloud(m, "SamplePointCloudPLY", - "Data class for `SamplePointCloudPLY` contains the " +void pybind_ply_point_cloud(py::module& m) { + // open3d.data.PLYPointCloud + py::class_, + std::shared_ptr, SingleDownloadDataset> + ply_pointcloud(m, "PLYPointCloud", + "Data class for `PLYPointCloud` contains the " "`fragment.pcd` point cloud mesh from the `Redwood " "Living Room` dataset."); - ply_pointcloud - .def(py::init(), - "prefix"_a = "SamplePointCloudPLY", "data_root"_a = "") - .def_property_readonly("path", &SamplePointCloudPLY::GetPath, + ply_pointcloud.def(py::init(), "data_root"_a = "") + .def_property_readonly("path", &PLYPointCloud::GetPath, "Path to the `ply` format point cloud."); - docstring::ClassMethodDocInject(m, "SamplePointCloudPLY", "path"); + docstring::ClassMethodDocInject(m, "PLYPointCloud", "path"); } -void pybind_sample_rgbd_image_nyu(py::module& m) { - // open3d.data.SampleRGBDImageNYU - py::class_, - std::shared_ptr, SingleDownloadDataset> - rgbd_image_nyu(m, "SampleRGBDImageNYU", - "Data class for `SampleRGBDImageNYU` contains a " +void pybind_sample_nyu_rgbd_image(py::module& m) { + // open3d.data.SampleNYURGBDImage + py::class_, + std::shared_ptr, SingleDownloadDataset> + rgbd_image_nyu(m, "SampleNYURGBDImage", + "Data class for `SampleNYURGBDImage` contains a " "color image `NYU_color.ppm` and a depth image " "`NYU_depth.pgm` sample from NYU RGBD dataset."); - rgbd_image_nyu - .def(py::init(), - "prefix"_a = "SampleRGBDImageNYU", "data_root"_a = "") + rgbd_image_nyu.def(py::init(), "data_root"_a = "") .def_property_readonly("color_path", - &SampleRGBDImageNYU::GetColorPath, + &SampleNYURGBDImage::GetColorPath, "Path to color image sample.") .def_property_readonly("depth_path", - &SampleRGBDImageNYU::GetDepthPath, + &SampleNYURGBDImage::GetDepthPath, "Path to depth image sample."); - docstring::ClassMethodDocInject(m, "SampleRGBDImageNYU", "color_path"); - docstring::ClassMethodDocInject(m, "SampleRGBDImageNYU", "depth_path"); + docstring::ClassMethodDocInject(m, "SampleNYURGBDImage", "color_path"); + docstring::ClassMethodDocInject(m, "SampleNYURGBDImage", "depth_path"); } -void pybind_sample_rgbd_image_sun(py::module& m) { - // open3d.data.SampleRGBDImageSUN - py::class_, - std::shared_ptr, SingleDownloadDataset> - rgbd_image_sun(m, "SampleRGBDImageSUN", - "Data class for `SampleRGBDImageSUN` contains a " +void pybind_sample_sun_rgbd_image(py::module& m) { + // open3d.data.SampleSUNRGBDImage + py::class_, + std::shared_ptr, SingleDownloadDataset> + rgbd_image_sun(m, "SampleSUNRGBDImage", + "Data class for `SampleSUNRGBDImage` contains a " "color image `SUN_color.jpg` and a depth image " "`SUN_depth.png` sample from SUN RGBD dataset."); - rgbd_image_sun - .def(py::init(), - "prefix"_a = "SampleRGBDImageSUN", "data_root"_a = "") + rgbd_image_sun.def(py::init(), "data_root"_a = "") .def_property_readonly("color_path", - &SampleRGBDImageSUN::GetColorPath, + &SampleSUNRGBDImage::GetColorPath, "Path to color image sample.") .def_property_readonly("depth_path", - &SampleRGBDImageSUN::GetDepthPath, + &SampleSUNRGBDImage::GetDepthPath, "Path to depth image sample."); - docstring::ClassMethodDocInject(m, "SampleRGBDImageSUN", "color_path"); - docstring::ClassMethodDocInject(m, "SampleRGBDImageSUN", "depth_path"); + docstring::ClassMethodDocInject(m, "SampleSUNRGBDImage", "color_path"); + docstring::ClassMethodDocInject(m, "SampleSUNRGBDImage", "depth_path"); } -void pybind_sample_rgbd_image_tum(py::module& m) { - // open3d.data.SampleRGBDImageTUM - py::class_, - std::shared_ptr, SingleDownloadDataset> - rgbd_image_tum(m, "SampleRGBDImageTUM", - "Data class for `SampleRGBDImageTUM` contains a " +void pybind_sample_tum_rgbd_image(py::module& m) { + // open3d.data.SampleTUMRGBDImage + py::class_, + std::shared_ptr, SingleDownloadDataset> + rgbd_image_tum(m, "SampleTUMRGBDImage", + "Data class for `SampleTUMRGBDImage` contains a " "color image `TUM_color.png` and a depth image " "`TUM_depth.png` sample from TUM RGBD dataset."); - rgbd_image_tum - .def(py::init(), - "prefix"_a = "SampleRGBDImageTUM", "data_root"_a = "") + rgbd_image_tum.def(py::init(), "data_root"_a = "") .def_property_readonly("color_path", - &SampleRGBDImageTUM::GetColorPath, + &SampleTUMRGBDImage::GetColorPath, "Path to color image sample.") .def_property_readonly("depth_path", - &SampleRGBDImageTUM::GetDepthPath, + &SampleTUMRGBDImage::GetDepthPath, "Path to depth image sample."); - docstring::ClassMethodDocInject(m, "SampleRGBDImageTUM", "color_path"); - docstring::ClassMethodDocInject(m, "SampleRGBDImageTUM", "depth_path"); + docstring::ClassMethodDocInject(m, "SampleTUMRGBDImage", "color_path"); + docstring::ClassMethodDocInject(m, "SampleTUMRGBDImage", "depth_path"); } -void pybind_sample_rgbd_dataset_redwood(py::module& m) { - // open3d.data.SampleRGBDDatasetRedwood - py::class_, - std::shared_ptr, SingleDownloadDataset> - rgbd_dataset_icl( - m, "SampleRGBDDatasetRedwood", - "Data class for `SampleRGBDDatasetICL` contains a sample " - "set of 5 color and depth images from Redwood RGBD " +void pybind_sample_redwood_rgbd_images(py::module& m) { + // open3d.data.SampleRedwoodRGBDImages + py::class_, + std::shared_ptr, SingleDownloadDataset> + rgbd_dataset_redwood( + m, "SampleRedwoodRGBDImages", + "Data class for `SampleRedwoodRGBDImages` contains a " + "sample set of 5 color and depth images from Redwood RGBD " "dataset living-room1. Additionally it also contains " - "camera trajectory log, camera odometry log, RGBD match, " - "and point cloud reconstruction from TSDF."); - rgbd_dataset_icl - .def(py::init(), - "prefix"_a = "SampleRGBDDatasetRedwood", "data_root"_a = "") + "camera trajectory log, camera odometry log, rgbd match, " + "and point cloud reconstruction obtained using TSDF."); + rgbd_dataset_redwood.def(py::init(), "data_root"_a = "") .def_property_readonly( - "color_paths", &SampleRGBDDatasetRedwood::GetColorPaths, + "color_paths", &SampleRedwoodRGBDImages::GetColorPaths, "List of paths to color image samples of size 5. Use " "`color_paths[0]`, `color_paths[1]` ... `color_paths[4]` " "to access the paths.") .def_property_readonly( - "depth_paths", &SampleRGBDDatasetRedwood::GetDepthPaths, + "depth_paths", &SampleRedwoodRGBDImages::GetDepthPaths, "List of paths to depth image samples of size 5. Use " "`depth_paths[0]`, `depth_paths[1]` ... `depth_paths[4]` " "to access the paths.") .def_property_readonly( "trajectory_log_path", - &SampleRGBDDatasetRedwood::GetTrajectoryLogPath, + &SampleRedwoodRGBDImages::GetTrajectoryLogPath, "Path to camera trajectory log file `trajectory.log`.") .def_property_readonly( "odometry_log_path", - &SampleRGBDDatasetRedwood::GetOdometryLogPath, + &SampleRedwoodRGBDImages::GetOdometryLogPath, "Path to camera odometry log file `odometry.log`.") .def_property_readonly( "rgbd_match_path", - &SampleRGBDDatasetRedwood::GetRGBDMatchPath, + &SampleRedwoodRGBDImages::GetRGBDMatchPath, "Path to color and depth image match file `rgbd.match`.") .def_property_readonly( "reconstruction_path", - &SampleRGBDDatasetRedwood::GetReconstructionPath, + &SampleRedwoodRGBDImages::GetReconstructionPath, "Path to pointcloud reconstruction from TSDF."); - docstring::ClassMethodDocInject(m, "SampleRGBDDatasetRedwood", + docstring::ClassMethodDocInject(m, "SampleRedwoodRGBDImages", "color_paths"); - docstring::ClassMethodDocInject(m, "SampleRGBDDatasetRedwood", + docstring::ClassMethodDocInject(m, "SampleRedwoodRGBDImages", "depth_paths"); - docstring::ClassMethodDocInject(m, "SampleRGBDDatasetRedwood", + docstring::ClassMethodDocInject(m, "SampleRedwoodRGBDImages", "trajectory_log_path"); - docstring::ClassMethodDocInject(m, "SampleRGBDDatasetRedwood", + docstring::ClassMethodDocInject(m, "SampleRedwoodRGBDImages", "odometry_log_path"); - docstring::ClassMethodDocInject(m, "SampleRGBDDatasetRedwood", + docstring::ClassMethodDocInject(m, "SampleRedwoodRGBDImages", "rgbd_match_path"); - docstring::ClassMethodDocInject(m, "SampleRGBDDatasetRedwood", + docstring::ClassMethodDocInject(m, "SampleRedwoodRGBDImages", "reconstruction_path"); } -void pybind_sample_fountain_rgbd_dataset(py::module& m) { - // open3d.data.SampleFountainRGBDDataset - py::class_, - std::shared_ptr, - SingleDownloadDataset> +void pybind_sample_fountain_rgbd_images(py::module& m) { + // open3d.data.SampleFountainRGBDImages + py::class_, + std::shared_ptr, SingleDownloadDataset> fountain_rgbd_dataset( - m, "SampleFountainRGBDDataset", - "Data class for `SampleFountainRGBDDataset` contains a " + m, "SampleFountainRGBDImages", + "Data class for `SampleFountainRGBDImages` contains a " "sample set of 33 color and depth images from the " "`Fountain RGBD dataset`. It also contains `camera poses " "at keyframes log` and `mesh reconstruction`. It is used " "in demo of `Color Map Optimization`."); fountain_rgbd_dataset - .def(py::init(), - "prefix"_a = "SampleFountainRGBDDataset", "data_root"_a = "") + .def(py::init(), "data_root"_a = "") .def_property_readonly( - "color_paths", &SampleFountainRGBDDataset::GetColorPaths, + "color_paths", &SampleFountainRGBDImages::GetColorPaths, "List of paths to color image samples of size 33. Use " "`color_paths[0]`, `color_paths[1]` ... `color_paths[32]` " "to access the paths.") .def_property_readonly( - "depth_paths", &SampleFountainRGBDDataset::GetDepthPaths, + "depth_paths", &SampleFountainRGBDImages::GetDepthPaths, "List of paths to depth image samples of size 33. Use " "`depth_paths[0]`, `depth_paths[1]` ... `depth_paths[32]` " "to access the paths.") .def_property_readonly( "keyframe_poses_log_path", - &SampleFountainRGBDDataset::GetKeyframePosesLogPath, + &SampleFountainRGBDImages::GetKeyframePosesLogPath, "Path to camera poses at keyfragmes log file `key.log`.") .def_property_readonly( "reconstruction_path", - &SampleFountainRGBDDataset::GetReconstructionPath, + &SampleFountainRGBDImages::GetReconstructionPath, "Path to mesh reconstruction."); - docstring::ClassMethodDocInject(m, "SampleFountainRGBDDataset", + docstring::ClassMethodDocInject(m, "SampleFountainRGBDImages", "color_paths"); - docstring::ClassMethodDocInject(m, "SampleFountainRGBDDataset", + docstring::ClassMethodDocInject(m, "SampleFountainRGBDImages", "depth_paths"); - docstring::ClassMethodDocInject(m, "SampleFountainRGBDDataset", + docstring::ClassMethodDocInject(m, "SampleFountainRGBDImages", "keyframe_poses_log_path"); - docstring::ClassMethodDocInject(m, "SampleFountainRGBDDataset", + docstring::ClassMethodDocInject(m, "SampleFountainRGBDImages", "reconstruction_path"); } @@ -427,8 +407,7 @@ void pybind_eagle(py::module& m) { "Data class for `EaglePointCloud` contains the " "`EaglePointCloud.ply` " "file."); - eagle.def(py::init(), - "prefix"_a = "EaglePointCloud", "data_root"_a = "") + eagle.def(py::init(), "data_root"_a = "") .def_property_readonly("path", &EaglePointCloud::GetPath, "Path to the `EaglePointCloud.ply` file."); docstring::ClassMethodDocInject(m, "EaglePointCloud", "path"); @@ -442,9 +421,7 @@ void pybind_armadillo(py::module& m) { "Data class for `ArmadilloMesh` contains the " "`ArmadilloMesh.ply` from the `Stanford 3D Scanning " "Repository`."); - armadillo - .def(py::init(), - "prefix"_a = "ArmadilloMesh", "data_root"_a = "") + armadillo.def(py::init(), "data_root"_a = "") .def_property_readonly("path", &ArmadilloMesh::GetPath, "Path to the `ArmadilloMesh.ply` file."); docstring::ClassMethodDocInject(m, "ArmadilloMesh", "path"); @@ -458,8 +435,7 @@ void pybind_bunny(py::module& m) { "Data class for `BunnyMesh` contains the `BunnyMesh.ply` " "from " "the `Stanford 3D Scanning Repository`."); - bunny.def(py::init(), - "prefix"_a = "BunnyMesh", "data_root"_a = "") + bunny.def(py::init(), "data_root"_a = "") .def_property_readonly("path", &BunnyMesh::GetPath, "Path to the `BunnyMesh.ply` file."); docstring::ClassMethodDocInject(m, "BunnyMesh", "path"); @@ -471,8 +447,7 @@ void pybind_knot(py::module& m) { SingleDownloadDataset> knot(m, "KnotMesh", "Data class for `KnotMesh` contains the `KnotMesh.ply`."); - knot.def(py::init(), - "prefix"_a = "KnotMesh", "data_root"_a = "") + knot.def(py::init(), "data_root"_a = "") .def_property_readonly("path", &KnotMesh::GetPath, "Path to the `KnotMesh.ply` file."); docstring::ClassMethodDocInject(m, "KnotMesh", "path"); @@ -486,61 +461,51 @@ void pybind_juneau(py::module& m) { "Data class for `JuneauImage` contains the " "`JuneauImage.jpg` " "file."); - juneau.def(py::init(), - "prefix"_a = "JuneauImage", "data_root"_a = "") + juneau.def(py::init(), "data_root"_a = "") .def_property_readonly("path", &JuneauImage::GetPath, "Path to the `JuneauImage.jgp` file."); docstring::ClassMethodDocInject(m, "JuneauImage", "path"); } -void pybind_redwood_living_room_pointclouds(py::module& m) { - // open3d.data.RedwoodLivingRoomPointClouds - py::class_, - std::shared_ptr, - SingleDownloadDataset> - redwood_living_room_pointclouds( - m, "RedwoodLivingRoomPointClouds", - "Dataset class for `RedwoodLivingRoomPointClouds` contains " +void pybind_living_room_point_clouds(py::module& m) { + // open3d.data.LivingRoomPointClouds + py::class_, + std::shared_ptr, SingleDownloadDataset> + living_room_point_clouds( + m, "LivingRoomPointClouds", + "Dataset class for `LivingRoomPointClouds` contains " "57 point clouds of binary PLY format."); - redwood_living_room_pointclouds - .def(py::init(), - "prefix"_a = "RedwoodLivingRoomPointClouds", - "data_root"_a = "") + living_room_point_clouds + .def(py::init(), "data_root"_a = "") .def_property_readonly( "paths", - [](const RedwoodLivingRoomPointClouds& - redwood_living_room_pointclouds) { - return redwood_living_room_pointclouds.GetPaths(); + [](const LivingRoomPointClouds& living_room_point_clouds) { + return living_room_point_clouds.GetPaths(); }, "List of paths to ply point-cloud fragments of size 57. " "Use `paths[0]`, `paths[1]` ... `paths[56]` to access the " "paths."); - docstring::ClassMethodDocInject(m, "RedwoodLivingRoomPointClouds", "paths"); + docstring::ClassMethodDocInject(m, "LivingRoomPointClouds", "paths"); } -void pybind_redwood_office_pointclouds(py::module& m) { - // open3d.data.RedwoodOfficePointClouds - py::class_, - std::shared_ptr, SingleDownloadDataset> - redwood_office_pointclouds( - m, "RedwoodOfficePointClouds", - "Dataset class for `RedwoodOfficePointClouds` contains 53 " +void pybind_office_point_clouds(py::module& m) { + // open3d.data.OfficePointClouds + py::class_, + std::shared_ptr, SingleDownloadDataset> + office_point_clouds( + m, "OfficePointClouds", + "Dataset class for `OfficePointClouds` contains 53 " "point clouds of binary PLY format."); - redwood_office_pointclouds - .def(py::init(), - "prefix"_a = "RedwoodOfficePointClouds", "data_root"_a = "") + office_point_clouds.def(py::init(), "data_root"_a = "") .def_property_readonly( "paths", - [](const RedwoodOfficePointClouds& - redwood_office_pointclouds) { - return redwood_office_pointclouds.GetPaths(); + [](const OfficePointClouds& office_point_clouds) { + return office_point_clouds.GetPaths(); }, "List of paths to ply point-cloud fragments of size 53. " "Use `paths[0]`, `paths[1]` ... `paths[52]` to access the " "paths."); - docstring::ClassMethodDocInject(m, "RedwoodOfficePointClouds", "paths"); + docstring::ClassMethodDocInject(m, "OfficePointClouds", "paths"); } void pybind_data(py::module& m) { @@ -550,22 +515,22 @@ void pybind_data(py::module& m) { pybind_demo_icp_pointclouds(m_submodule); pybind_demo_colored_icp_pointclouds(m_submodule); pybind_demo_crop_pointcloud(m_submodule); - pybind_demo_pointcloud_feature_matching(m_submodule); + pybind_demo_feature_matching_point_clouds(m_submodule); pybind_demo_pose_graph_optimization(m_submodule); - pybind_sample_pointcloud_pcd(m_submodule); - pybind_sample_pointcloud_ply(m_submodule); - pybind_sample_rgbd_image_nyu(m_submodule); - pybind_sample_rgbd_image_sun(m_submodule); - pybind_sample_rgbd_image_tum(m_submodule); - pybind_sample_rgbd_dataset_redwood(m_submodule); - pybind_sample_fountain_rgbd_dataset(m_submodule); + pybind_pcd_point_cloud(m_submodule); + pybind_ply_point_cloud(m_submodule); + pybind_sample_nyu_rgbd_image(m_submodule); + pybind_sample_sun_rgbd_image(m_submodule); + pybind_sample_tum_rgbd_image(m_submodule); + pybind_sample_redwood_rgbd_images(m_submodule); + pybind_sample_fountain_rgbd_images(m_submodule); pybind_eagle(m_submodule); pybind_armadillo(m_submodule); pybind_bunny(m_submodule); pybind_knot(m_submodule); pybind_juneau(m_submodule); - pybind_redwood_living_room_pointclouds(m_submodule); - pybind_redwood_office_pointclouds(m_submodule); + pybind_living_room_point_clouds(m_submodule); + pybind_office_point_clouds(m_submodule); } } // namespace data diff --git a/cpp/tests/data/Dataset.cpp b/cpp/tests/data/Dataset.cpp index 4159d25d1c6..639a8f056dd 100644 --- a/cpp/tests/data/Dataset.cpp +++ b/cpp/tests/data/Dataset.cpp @@ -51,9 +51,9 @@ TEST(Dataset, DatasetBase) { } TEST(Dataset, SingleDownloadDataset) { - const std::string prefix = "O3DTestSimpleDataset"; - const std::string data_root = - utility::filesystem::GetHomeDirectory() + "/open3d_data"; + const std::string prefix = "SingleDownloadDataset"; + const std::string data_root = utility::filesystem::GetHomeDirectory() + + "/open3d_data/open3d_test"; const std::string download_dir = data_root + "/download/" + prefix; const std::string extract_dir = data_root + "/extract/" + prefix; @@ -66,9 +66,9 @@ TEST(Dataset, SingleDownloadDataset) { "20220201-data/BunnyMesh.ply"}; const std::string md5 = "568f871d1a221ba6627569f1e6f9a3f2"; - data::SingleDownloadDataset single_download_dataset(prefix, url_mirrors, - md5, - /*no_extact*/ true); + data::SingleDownloadDataset single_download_dataset( + prefix, url_mirrors, md5, + /*no_extact*/ true, data_root); // Check if file is downloaded and extracted / copied. EXPECT_TRUE( @@ -88,9 +88,9 @@ TEST(Dataset, SingleDownloadDataset) { } TEST(Dataset, DemoICPPointClouds) { - const std::string prefix = "O3DTestDemoICPPointClouds"; - const std::string data_root = - utility::filesystem::GetHomeDirectory() + "/open3d_data"; + const std::string prefix = "DemoICPPointClouds"; + const std::string data_root = utility::filesystem::GetHomeDirectory() + + "/open3d_data/open3d_test"; const std::string download_dir = data_root + "/download/" + prefix; const std::string extract_dir = data_root + "/extract/" + prefix; @@ -98,7 +98,7 @@ TEST(Dataset, DemoICPPointClouds) { utility::filesystem::DeleteDirectory(data_root + "/download/" + prefix); utility::filesystem::DeleteDirectory(data_root + "/extract/" + prefix); - data::DemoICPPointClouds demo_icp(prefix); + data::DemoICPPointClouds demo_icp(data_root); // Check if downloaded. EXPECT_TRUE(utility::filesystem::DirectoryExists(download_dir)); @@ -125,9 +125,9 @@ TEST(Dataset, DemoICPPointClouds) { } TEST(Dataset, DemoColoredICPPointClouds) { - const std::string prefix = "O3DTestDemoColoredICPPointClouds"; - const std::string data_root = - utility::filesystem::GetHomeDirectory() + "/open3d_data"; + const std::string prefix = "DemoColoredICPPointClouds"; + const std::string data_root = utility::filesystem::GetHomeDirectory() + + "/open3d_data/open3d_test"; const std::string download_dir = data_root + "/download/" + prefix; const std::string extract_dir = data_root + "/extract/" + prefix; @@ -135,7 +135,7 @@ TEST(Dataset, DemoColoredICPPointClouds) { utility::filesystem::DeleteDirectory(data_root + "/download/" + prefix); utility::filesystem::DeleteDirectory(data_root + "/extract/" + prefix); - data::DemoColoredICPPointClouds demo_cicp(prefix); + data::DemoColoredICPPointClouds demo_cicp(data_root); // Check if downloaded. EXPECT_TRUE(utility::filesystem::DirectoryExists(download_dir)); @@ -161,9 +161,9 @@ TEST(Dataset, DemoColoredICPPointClouds) { } TEST(Dataset, DemoCropPointCloud) { - const std::string prefix = "O3DTestDemoCropPointCloud"; - const std::string data_root = - utility::filesystem::GetHomeDirectory() + "/open3d_data"; + const std::string prefix = "DemoCropPointCloud"; + const std::string data_root = utility::filesystem::GetHomeDirectory() + + "/open3d_data/open3d_test"; const std::string download_dir = data_root + "/download/" + prefix; const std::string extract_dir = data_root + "/extract/" + prefix; @@ -171,7 +171,7 @@ TEST(Dataset, DemoCropPointCloud) { utility::filesystem::DeleteDirectory(data_root + "/download/" + prefix); utility::filesystem::DeleteDirectory(data_root + "/extract/" + prefix); - data::DemoCropPointCloud demo_crop_pcd(prefix); + data::DemoCropPointCloud demo_crop_pcd(data_root); // Check if downloaded. EXPECT_TRUE(utility::filesystem::DirectoryExists(download_dir)); @@ -195,10 +195,10 @@ TEST(Dataset, DemoCropPointCloud) { utility::filesystem::DeleteDirectory(extract_dir); } -TEST(Dataset, DemoPointCloudFeatureMatching) { - const std::string prefix = "O3DTestDemoPointCloudFeatureMatching"; - const std::string data_root = - utility::filesystem::GetHomeDirectory() + "/open3d_data"; +TEST(Dataset, DemoFeatureMatchingPointClouds) { + const std::string prefix = "DemoFeatureMatchingPointClouds"; + const std::string data_root = utility::filesystem::GetHomeDirectory() + + "/open3d_data/open3d_test"; const std::string download_dir = data_root + "/download/" + prefix; const std::string extract_dir = data_root + "/extract/" + prefix; @@ -206,14 +206,14 @@ TEST(Dataset, DemoPointCloudFeatureMatching) { utility::filesystem::DeleteDirectory(data_root + "/download/" + prefix); utility::filesystem::DeleteDirectory(data_root + "/extract/" + prefix); - data::DemoPointCloudFeatureMatching demo_feature_matching(prefix); + data::DemoFeatureMatchingPointClouds demo_feature_matching(data_root); // Check if downloaded. EXPECT_TRUE(utility::filesystem::DirectoryExists(download_dir)); // Methods to get path. - const std::vector pointcloud_paths = { + const std::vector point_cloud_paths = { extract_dir + "/cloud_bin_0.pcd", extract_dir + "/cloud_bin_1.pcd"}; - EXPECT_EQ(demo_feature_matching.GetPointCloudPaths(), pointcloud_paths); + EXPECT_EQ(demo_feature_matching.GetPointCloudPaths(), point_cloud_paths); const std::vector fpfh_feature_paths = { extract_dir + "/cloud_bin_0.fpfh.bin", @@ -237,9 +237,9 @@ TEST(Dataset, DemoPointCloudFeatureMatching) { } TEST(Dataset, DemoPoseGraphOptimization) { - const std::string prefix = "O3DTestDemoPoseGraphOptimization"; - const std::string data_root = - utility::filesystem::GetHomeDirectory() + "/open3d_data"; + const std::string prefix = "DemoPoseGraphOptimization"; + const std::string data_root = utility::filesystem::GetHomeDirectory() + + "/open3d_data/open3d_test"; const std::string download_dir = data_root + "/download/" + prefix; const std::string extract_dir = data_root + "/extract/" + prefix; @@ -247,7 +247,7 @@ TEST(Dataset, DemoPoseGraphOptimization) { utility::filesystem::DeleteDirectory(data_root + "/download/" + prefix); utility::filesystem::DeleteDirectory(data_root + "/extract/" + prefix); - data::DemoPoseGraphOptimization demo_pose_optimization(prefix); + data::DemoPoseGraphOptimization demo_pose_optimization(data_root); // Check if downloaded. EXPECT_TRUE(utility::filesystem::DirectoryExists(download_dir)); @@ -268,10 +268,10 @@ TEST(Dataset, DemoPoseGraphOptimization) { utility::filesystem::DeleteDirectory(extract_dir); } -TEST(Dataset, SamplePointCloudPCD) { - const std::string prefix = "O3DTestSamplePointCloudPCD"; - const std::string data_root = - utility::filesystem::GetHomeDirectory() + "/open3d_data"; +TEST(Dataset, PCDPointCloud) { + const std::string prefix = "PCDPointCloud"; + const std::string data_root = utility::filesystem::GetHomeDirectory() + + "/open3d_data/open3d_test"; const std::string download_dir = data_root + "/download/" + prefix; const std::string extract_dir = data_root + "/extract/" + prefix; @@ -279,7 +279,7 @@ TEST(Dataset, SamplePointCloudPCD) { utility::filesystem::DeleteDirectory(data_root + "/download/" + prefix); utility::filesystem::DeleteDirectory(data_root + "/extract/" + prefix); - data::SamplePointCloudPCD pointcloud_pcd(prefix); + data::PCDPointCloud pointcloud_pcd(data_root); // Check if downloaded. EXPECT_TRUE(utility::filesystem::DirectoryExists(download_dir)); @@ -299,10 +299,10 @@ TEST(Dataset, SamplePointCloudPCD) { utility::filesystem::DeleteDirectory(extract_dir); } -TEST(Dataset, SamplePointCloudPLY) { - const std::string prefix = "O3DTestSamplePointCloudPLY"; - const std::string data_root = - utility::filesystem::GetHomeDirectory() + "/open3d_data"; +TEST(Dataset, PLYPointCloud) { + const std::string prefix = "PLYPointCloud"; + const std::string data_root = utility::filesystem::GetHomeDirectory() + + "/open3d_data/open3d_test"; const std::string download_dir = data_root + "/download/" + prefix; const std::string extract_dir = data_root + "/extract/" + prefix; @@ -310,7 +310,7 @@ TEST(Dataset, SamplePointCloudPLY) { utility::filesystem::DeleteDirectory(data_root + "/download/" + prefix); utility::filesystem::DeleteDirectory(data_root + "/extract/" + prefix); - data::SamplePointCloudPLY pointcloud_ply(prefix); + data::PLYPointCloud pointcloud_ply(data_root); // Check if downloaded. EXPECT_TRUE(utility::filesystem::DirectoryExists(download_dir)); @@ -330,10 +330,10 @@ TEST(Dataset, SamplePointCloudPLY) { utility::filesystem::DeleteDirectory(extract_dir); } -TEST(Dataset, SampleRGBDImageNYU) { - const std::string prefix = "O3DTestSampleRGBDImageNYU"; - const std::string data_root = - utility::filesystem::GetHomeDirectory() + "/open3d_data"; +TEST(Dataset, SampleNYURGBDImage) { + const std::string prefix = "SampleNYURGBDImage"; + const std::string data_root = utility::filesystem::GetHomeDirectory() + + "/open3d_data/open3d_test"; const std::string download_dir = data_root + "/download/" + prefix; const std::string extract_dir = data_root + "/extract/" + prefix; @@ -341,7 +341,7 @@ TEST(Dataset, SampleRGBDImageNYU) { utility::filesystem::DeleteDirectory(data_root + "/download/" + prefix); utility::filesystem::DeleteDirectory(data_root + "/extract/" + prefix); - data::SampleRGBDImageNYU rgbd_nyu(prefix); + data::SampleNYURGBDImage rgbd_nyu(data_root); // Check if downloaded. EXPECT_TRUE(utility::filesystem::DirectoryExists(download_dir)); @@ -362,10 +362,10 @@ TEST(Dataset, SampleRGBDImageNYU) { utility::filesystem::DeleteDirectory(extract_dir); } -TEST(Dataset, SampleRGBDImageSUN) { - const std::string prefix = "O3DTestSampleRGBDImageSUN"; - const std::string data_root = - utility::filesystem::GetHomeDirectory() + "/open3d_data"; +TEST(Dataset, SampleSUNRGBDImage) { + const std::string prefix = "SampleSUNRGBDImage"; + const std::string data_root = utility::filesystem::GetHomeDirectory() + + "/open3d_data/open3d_test"; const std::string download_dir = data_root + "/download/" + prefix; const std::string extract_dir = data_root + "/extract/" + prefix; @@ -373,7 +373,7 @@ TEST(Dataset, SampleRGBDImageSUN) { utility::filesystem::DeleteDirectory(data_root + "/download/" + prefix); utility::filesystem::DeleteDirectory(data_root + "/extract/" + prefix); - data::SampleRGBDImageSUN rgbd_sun(prefix); + data::SampleSUNRGBDImage rgbd_sun(data_root); // Check if downloaded. EXPECT_TRUE(utility::filesystem::DirectoryExists(download_dir)); @@ -394,10 +394,10 @@ TEST(Dataset, SampleRGBDImageSUN) { utility::filesystem::DeleteDirectory(extract_dir); } -TEST(Dataset, SampleRGBDImageTUM) { - const std::string prefix = "O3DTestSampleRGBDImageTUM"; - const std::string data_root = - utility::filesystem::GetHomeDirectory() + "/open3d_data"; +TEST(Dataset, SampleTUMRGBDImage) { + const std::string prefix = "SampleTUMRGBDImage"; + const std::string data_root = utility::filesystem::GetHomeDirectory() + + "/open3d_data/open3d_test"; const std::string download_dir = data_root + "/download/" + prefix; const std::string extract_dir = data_root + "/extract/" + prefix; @@ -405,7 +405,7 @@ TEST(Dataset, SampleRGBDImageTUM) { utility::filesystem::DeleteDirectory(data_root + "/download/" + prefix); utility::filesystem::DeleteDirectory(data_root + "/extract/" + prefix); - data::SampleRGBDImageTUM rgbd_tum(prefix); + data::SampleTUMRGBDImage rgbd_tum(data_root); // Check if downloaded. EXPECT_TRUE(utility::filesystem::DirectoryExists(download_dir)); @@ -426,10 +426,10 @@ TEST(Dataset, SampleRGBDImageTUM) { utility::filesystem::DeleteDirectory(extract_dir); } -TEST(Dataset, SampleRGBDDatasetRedwood) { - const std::string prefix = "O3DTestSampleRGBDDatasetRedwood"; - const std::string data_root = - utility::filesystem::GetHomeDirectory() + "/open3d_data"; +TEST(Dataset, SampleRedwoodRGBDImages) { + const std::string prefix = "SampleRedwoodRGBDImages"; + const std::string data_root = utility::filesystem::GetHomeDirectory() + + "/open3d_data/open3d_test"; const std::string download_dir = data_root + "/download/" + prefix; const std::string extract_dir = data_root + "/extract/" + prefix; @@ -437,7 +437,7 @@ TEST(Dataset, SampleRGBDDatasetRedwood) { utility::filesystem::DeleteDirectory(data_root + "/download/" + prefix); utility::filesystem::DeleteDirectory(data_root + "/extract/" + prefix); - data::SampleRGBDDatasetRedwood rgbd_icl(prefix); + data::SampleRedwoodRGBDImages rgbd_redwood(data_root); // Check if downloaded. EXPECT_TRUE(utility::filesystem::DirectoryExists(download_dir)); @@ -446,50 +446,53 @@ TEST(Dataset, SampleRGBDDatasetRedwood) { extract_dir + "/color/00000.jpg", extract_dir + "/color/00001.jpg", extract_dir + "/color/00002.jpg", extract_dir + "/color/00003.jpg", extract_dir + "/color/00004.jpg"}; - EXPECT_EQ(rgbd_icl.GetColorPaths(), color_paths); + EXPECT_EQ(rgbd_redwood.GetColorPaths(), color_paths); const std::vector depth_paths = { extract_dir + "/depth/00000.png", extract_dir + "/depth/00001.png", extract_dir + "/depth/00002.png", extract_dir + "/depth/00003.png", extract_dir + "/depth/00004.png"}; - EXPECT_EQ(rgbd_icl.GetDepthPaths(), depth_paths); + EXPECT_EQ(rgbd_redwood.GetDepthPaths(), depth_paths); for (size_t i = 0; i < color_paths.size(); ++i) { - EXPECT_TRUE( - utility::filesystem::FileExists(rgbd_icl.GetColorPaths()[i])); - EXPECT_TRUE( - utility::filesystem::FileExists(rgbd_icl.GetDepthPaths()[i])); + EXPECT_TRUE(utility::filesystem::FileExists( + rgbd_redwood.GetColorPaths()[i])); + EXPECT_TRUE(utility::filesystem::FileExists( + rgbd_redwood.GetDepthPaths()[i])); } - EXPECT_EQ(rgbd_icl.GetTrajectoryLogPath(), extract_dir + "/trajectory.log"); - EXPECT_TRUE( - utility::filesystem::FileExists(rgbd_icl.GetTrajectoryLogPath())); + EXPECT_EQ(rgbd_redwood.GetTrajectoryLogPath(), + extract_dir + "/trajectory.log"); + EXPECT_TRUE(utility::filesystem::FileExists( + rgbd_redwood.GetTrajectoryLogPath())); - EXPECT_EQ(rgbd_icl.GetOdometryLogPath(), extract_dir + "/odometry.log"); - EXPECT_TRUE(utility::filesystem::FileExists(rgbd_icl.GetOdometryLogPath())); + EXPECT_EQ(rgbd_redwood.GetOdometryLogPath(), extract_dir + "/odometry.log"); + EXPECT_TRUE( + utility::filesystem::FileExists(rgbd_redwood.GetOdometryLogPath())); - EXPECT_EQ(rgbd_icl.GetRGBDMatchPath(), extract_dir + "/rgbd.match"); - EXPECT_TRUE(utility::filesystem::FileExists(rgbd_icl.GetRGBDMatchPath())); + EXPECT_EQ(rgbd_redwood.GetRGBDMatchPath(), extract_dir + "/rgbd.match"); + EXPECT_TRUE( + utility::filesystem::FileExists(rgbd_redwood.GetRGBDMatchPath())); - EXPECT_EQ(rgbd_icl.GetReconstructionPath(), + EXPECT_EQ(rgbd_redwood.GetReconstructionPath(), extract_dir + "/example_tsdf_pcd.ply"); - EXPECT_TRUE( - utility::filesystem::FileExists(rgbd_icl.GetReconstructionPath())); + EXPECT_TRUE(utility::filesystem::FileExists( + rgbd_redwood.GetReconstructionPath())); // Basic method. - EXPECT_EQ(rgbd_icl.GetPrefix(), prefix); - EXPECT_EQ(rgbd_icl.GetDataRoot(), data_root); - EXPECT_EQ(rgbd_icl.GetDownloadDir(), download_dir); - EXPECT_EQ(rgbd_icl.GetExtractDir(), extract_dir); + EXPECT_EQ(rgbd_redwood.GetPrefix(), prefix); + EXPECT_EQ(rgbd_redwood.GetDataRoot(), data_root); + EXPECT_EQ(rgbd_redwood.GetDownloadDir(), download_dir); + EXPECT_EQ(rgbd_redwood.GetExtractDir(), extract_dir); // Delete dataset. utility::filesystem::DeleteDirectory(download_dir); utility::filesystem::DeleteDirectory(extract_dir); } -TEST(Dataset, SampleFountainRGBDDataset) { - const std::string prefix = "O3DTestSampleFountainRGBDDataset"; - const std::string data_root = - utility::filesystem::GetHomeDirectory() + "/open3d_data"; +TEST(Dataset, SampleFountainRGBDImages) { + const std::string prefix = "SampleFountainRGBDImages"; + const std::string data_root = utility::filesystem::GetHomeDirectory() + + "/open3d_data/open3d_test"; const std::string download_dir = data_root + "/download/" + prefix; const std::string extract_dir = data_root + "/extract/" + prefix; @@ -497,7 +500,7 @@ TEST(Dataset, SampleFountainRGBDDataset) { utility::filesystem::DeleteDirectory(data_root + "/download/" + prefix); utility::filesystem::DeleteDirectory(data_root + "/extract/" + prefix); - data::SampleFountainRGBDDataset rgbd_fountain(prefix); + data::SampleFountainRGBDImages rgbd_fountain(data_root); // Check if downloaded. EXPECT_TRUE(utility::filesystem::DirectoryExists(download_dir)); @@ -603,9 +606,9 @@ TEST(Dataset, SampleFountainRGBDDataset) { } TEST(Dataset, EaglePointCloud) { - const std::string prefix = "O3DTestEagle"; - const std::string data_root = - utility::filesystem::GetHomeDirectory() + "/open3d_data"; + const std::string prefix = "EaglePointCloud"; + const std::string data_root = utility::filesystem::GetHomeDirectory() + + "/open3d_data/open3d_test"; const std::string download_dir = data_root + "/download/" + prefix; const std::string extract_dir = data_root + "/extract/" + prefix; @@ -613,7 +616,7 @@ TEST(Dataset, EaglePointCloud) { utility::filesystem::DeleteDirectory(data_root + "/download/" + prefix); utility::filesystem::DeleteDirectory(data_root + "/extract/" + prefix); - data::EaglePointCloud eagle(prefix); + data::EaglePointCloud eagle(data_root); // Check if downloaded. EXPECT_TRUE(utility::filesystem::DirectoryExists(download_dir)); @@ -634,9 +637,9 @@ TEST(Dataset, EaglePointCloud) { } TEST(Dataset, ArmadilloMesh) { - const std::string prefix = "O3DTestArmadillo"; - const std::string data_root = - utility::filesystem::GetHomeDirectory() + "/open3d_data"; + const std::string prefix = "ArmadilloMesh"; + const std::string data_root = utility::filesystem::GetHomeDirectory() + + "/open3d_data/open3d_test"; const std::string download_dir = data_root + "/download/" + prefix; const std::string extract_dir = data_root + "/extract/" + prefix; @@ -644,7 +647,7 @@ TEST(Dataset, ArmadilloMesh) { utility::filesystem::DeleteDirectory(data_root + "/download/" + prefix); utility::filesystem::DeleteDirectory(data_root + "/extract/" + prefix); - data::ArmadilloMesh armadillo(prefix); + data::ArmadilloMesh armadillo(data_root); // Check if downloaded. EXPECT_TRUE(utility::filesystem::DirectoryExists(download_dir)); @@ -665,9 +668,9 @@ TEST(Dataset, ArmadilloMesh) { } TEST(Dataset, BunnyMesh) { - const std::string prefix = "O3DTestBunny"; - const std::string data_root = - utility::filesystem::GetHomeDirectory() + "/open3d_data"; + const std::string prefix = "BunnyMesh"; + const std::string data_root = utility::filesystem::GetHomeDirectory() + + "/open3d_data/open3d_test"; const std::string download_dir = data_root + "/download/" + prefix; const std::string extract_dir = data_root + "/extract/" + prefix; @@ -675,7 +678,7 @@ TEST(Dataset, BunnyMesh) { utility::filesystem::DeleteDirectory(data_root + "/download/" + prefix); utility::filesystem::DeleteDirectory(data_root + "/extract/" + prefix); - data::BunnyMesh bunny(prefix); + data::BunnyMesh bunny(data_root); // Check if downloaded. EXPECT_TRUE(utility::filesystem::DirectoryExists(download_dir)); @@ -696,9 +699,9 @@ TEST(Dataset, BunnyMesh) { } TEST(Dataset, KnotMesh) { - const std::string prefix = "O3DTestKnot"; - const std::string data_root = - utility::filesystem::GetHomeDirectory() + "/open3d_data"; + const std::string prefix = "KnotMesh"; + const std::string data_root = utility::filesystem::GetHomeDirectory() + + "/open3d_data/open3d_test"; const std::string download_dir = data_root + "/download/" + prefix; const std::string extract_dir = data_root + "/extract/" + prefix; @@ -706,7 +709,7 @@ TEST(Dataset, KnotMesh) { utility::filesystem::DeleteDirectory(data_root + "/download/" + prefix); utility::filesystem::DeleteDirectory(data_root + "/extract/" + prefix); - data::KnotMesh knot(prefix); + data::KnotMesh knot(data_root); // Check if downloaded. EXPECT_TRUE(utility::filesystem::DirectoryExists(download_dir)); @@ -727,9 +730,9 @@ TEST(Dataset, KnotMesh) { } TEST(Dataset, JuneauImage) { - const std::string prefix = "O3DTestJuneau"; - const std::string data_root = - utility::filesystem::GetHomeDirectory() + "/open3d_data"; + const std::string prefix = "JuneauImage"; + const std::string data_root = utility::filesystem::GetHomeDirectory() + + "/open3d_data/open3d_test"; const std::string download_dir = data_root + "/download/" + prefix; const std::string extract_dir = data_root + "/extract/" + prefix; @@ -737,7 +740,7 @@ TEST(Dataset, JuneauImage) { utility::filesystem::DeleteDirectory(data_root + "/download/" + prefix); utility::filesystem::DeleteDirectory(data_root + "/extract/" + prefix); - data::JuneauImage juneau(prefix); + data::JuneauImage juneau(data_root); // Check if downloaded. EXPECT_TRUE(utility::filesystem::DirectoryExists(download_dir)); @@ -758,9 +761,9 @@ TEST(Dataset, JuneauImage) { } TEST(Dataset, DISABLED_RedwoodLivingRoomPointClouds) { - const std::string prefix = "O3DTestRedwoodLivingRoomPointClouds"; - const std::string data_root = - utility::filesystem::GetHomeDirectory() + "/open3d_data"; + const std::string prefix = "LivingRoomPointClouds"; + const std::string data_root = utility::filesystem::GetHomeDirectory() + + "/open3d_data/open3d_test"; const std::string download_dir = data_root + "/download/" + prefix; const std::string extract_dir = data_root + "/extract/" + prefix; @@ -768,7 +771,7 @@ TEST(Dataset, DISABLED_RedwoodLivingRoomPointClouds) { utility::filesystem::DeleteDirectory(data_root + "/download/" + prefix); utility::filesystem::DeleteDirectory(data_root + "/extract/" + prefix); - data::RedwoodLivingRoomPointClouds living_room(prefix); + data::LivingRoomPointClouds living_room(data_root); // Check if downloaded. EXPECT_TRUE(utility::filesystem::DirectoryExists(download_dir)); @@ -798,9 +801,9 @@ TEST(Dataset, DISABLED_RedwoodLivingRoomPointClouds) { } TEST(Dataset, DISABLED_RedwoodOfficePointClouds) { - const std::string prefix = "O3DTestRedwoodOfficePointClouds"; - const std::string data_root = - utility::filesystem::GetHomeDirectory() + "/open3d_data"; + const std::string prefix = "OfficePointClouds"; + const std::string data_root = utility::filesystem::GetHomeDirectory() + + "/open3d_data/open3d_test"; const std::string download_dir = data_root + "/download/" + prefix; const std::string extract_dir = data_root + "/extract/" + prefix; @@ -808,7 +811,7 @@ TEST(Dataset, DISABLED_RedwoodOfficePointClouds) { utility::filesystem::DeleteDirectory(data_root + "/download/" + prefix); utility::filesystem::DeleteDirectory(data_root + "/extract/" + prefix); - data::RedwoodOfficePointClouds office(prefix); + data::OfficePointClouds office(data_root); // Check if downloaded. EXPECT_TRUE(utility::filesystem::DirectoryExists(download_dir)); diff --git a/cpp/tests/geometry/Octree.cpp b/cpp/tests/geometry/Octree.cpp index 42272477733..38a28e2f4d3 100644 --- a/cpp/tests/geometry/Octree.cpp +++ b/cpp/tests/geometry/Octree.cpp @@ -336,7 +336,7 @@ TEST(Octree, EightCubesTraverse) { TEST(Octree, FragmentPLYCheckClone) { // Build src_octree geometry::PointCloud pcd; - data::SamplePointCloudPLY pointcloud_ply; + data::PLYPointCloud pointcloud_ply; io::ReadPointCloud(pointcloud_ply.GetPath(), pcd); geometry::Octree src_octree(5); src_octree.ConvertFromPointCloud(pcd, 0.01); @@ -357,7 +357,7 @@ TEST(Octree, EqualOperatorSpecialCase) { TEST(Octree, FragmentPLYLocate) { // Build src_octree geometry::PointCloud pcd; - data::SamplePointCloudPLY pointcloud_ply; + data::PLYPointCloud pointcloud_ply; io::ReadPointCloud(pointcloud_ply.GetPath(), pcd); size_t max_depth = 5; geometry::Octree octree(max_depth); @@ -400,7 +400,7 @@ TEST(Octree, ConvertFromPointCloudBoundTwoPoints) { TEST(Octree, Visualization) { geometry::PointCloud pcd; - data::SamplePointCloudPLY pointcloud_ply; + data::PLYPointCloud pointcloud_ply; io::ReadPointCloud(pointcloud_ply.GetPath(), pcd); auto octree = std::make_shared(6); octree->ConvertFromPointCloud(pcd, 0.01); @@ -410,7 +410,7 @@ TEST(Octree, Visualization) { TEST(Octree, ConvertToJsonValue) { geometry::PointCloud pcd; - data::SamplePointCloudPLY pointcloud_ply; + data::PLYPointCloud pointcloud_ply; io::ReadPointCloud(pointcloud_ply.GetPath(), pcd); size_t max_depth = 5; geometry::Octree src_octree(max_depth); diff --git a/cpp/tests/geometry/PointCloud.cpp b/cpp/tests/geometry/PointCloud.cpp index f10c5b40c10..6679afe9285 100644 --- a/cpp/tests/geometry/PointCloud.cpp +++ b/cpp/tests/geometry/PointCloud.cpp @@ -1188,7 +1188,7 @@ TEST(PointCloud, ComputeConvexHull) { TEST(PointCloud, HiddenPointRemoval) { geometry::PointCloud pcd; - data::SamplePointCloudPLY pointcloud_ply; + data::PLYPointCloud pointcloud_ply; io::ReadPointCloud(pointcloud_ply.GetPath(), pcd); EXPECT_EQ(pcd.points_.size(), 196133); ExpectEQ(pcd.GetMaxBound(), Eigen::Vector3d(3.96609, 2.427476, 2.55859)); @@ -1205,7 +1205,7 @@ TEST(PointCloud, HiddenPointRemoval) { TEST(PointCloud, ClusterDBSCAN) { geometry::PointCloud pcd; - data::SamplePointCloudPLY pointcloud_ply; + data::PLYPointCloud pointcloud_ply; io::ReadPointCloud(pointcloud_ply.GetPath(), pcd); EXPECT_EQ(pcd.points_.size(), 196133); @@ -1220,7 +1220,7 @@ TEST(PointCloud, ClusterDBSCAN) { TEST(PointCloud, SegmentPlane) { geometry::PointCloud pcd; - data::SamplePointCloudPCD pointcloud_pcd; + data::PCDPointCloud pointcloud_pcd; io::ReadPointCloud(pointcloud_pcd.GetPath(), pcd); EXPECT_EQ(pcd.points_.size(), 113662); @@ -1255,7 +1255,7 @@ TEST(PointCloud, SegmentPlaneKnownPlane) { } TEST(PointCloud, CreateFromDepthImage) { - data::SampleRGBDDatasetRedwood redwood_data; + data::SampleRedwoodRGBDImages redwood_data; const std::string trajectory_path = redwood_data.GetTrajectoryLogPath(); const std::string im_depth_path = redwood_data.GetDepthPaths()[0]; @@ -1282,7 +1282,7 @@ TEST(PointCloud, CreateFromDepthImage) { } TEST(PointCloud, CreateFromRGBDImage) { - data::SampleRGBDDatasetRedwood redwood_data; + data::SampleRedwoodRGBDImages redwood_data; const std::string trajectory_path = redwood_data.GetTrajectoryLogPath(); const std::string im_depth_path = redwood_data.GetDepthPaths()[0]; const std::string im_rgb_path = redwood_data.GetColorPaths()[0]; diff --git a/cpp/tests/geometry/RGBDImage.cpp b/cpp/tests/geometry/RGBDImage.cpp index 7227562bff8..60c82f3c1c6 100644 --- a/cpp/tests/geometry/RGBDImage.cpp +++ b/cpp/tests/geometry/RGBDImage.cpp @@ -91,7 +91,7 @@ std::pair FloatImageMinMax(const geometry::Image& im) { TEST(RGBDImage, CreateFromColorAndDepth) { geometry::Image im_color; - data::SampleRGBDDatasetRedwood redwood_data; + data::SampleRedwoodRGBDImages redwood_data; EXPECT_TRUE(io::ReadImage(redwood_data.GetColorPaths()[0], im_color)); EXPECT_EQ(im_color.num_of_channels_, 3); EXPECT_EQ(im_color.bytes_per_channel_, 1); @@ -125,7 +125,7 @@ TEST(RGBDImage, CreateFromColorAndDepth) { TEST(RGBDImage, CreateFromRedwoodFormat) { geometry::Image im_color; - data::SampleRGBDDatasetRedwood redwood_data; + data::SampleRedwoodRGBDImages redwood_data; EXPECT_TRUE(io::ReadImage(redwood_data.GetColorPaths()[0], im_color)); EXPECT_EQ(im_color.num_of_channels_, 3); EXPECT_EQ(im_color.bytes_per_channel_, 1); @@ -159,7 +159,7 @@ TEST(RGBDImage, CreateFromRedwoodFormat) { TEST(RGBDImage, CreateFromTUMFormat) { geometry::Image im_color; - data::SampleRGBDImageTUM tum_data; + data::SampleTUMRGBDImage tum_data; EXPECT_TRUE(io::ReadImage(tum_data.GetColorPath(), im_color)); EXPECT_EQ(im_color.num_of_channels_, 3); EXPECT_EQ(im_color.bytes_per_channel_, 1); @@ -193,7 +193,7 @@ TEST(RGBDImage, CreateFromTUMFormat) { TEST(RGBDImage, CreateFromSUNFormat) { geometry::Image im_color; - data::SampleRGBDImageSUN sun_data; + data::SampleSUNRGBDImage sun_data; EXPECT_TRUE(io::ReadImage(sun_data.GetColorPath(), im_color)); EXPECT_EQ(im_color.num_of_channels_, 3); EXPECT_EQ(im_color.bytes_per_channel_, 1); diff --git a/cpp/tests/io/OctreeIO.cpp b/cpp/tests/io/OctreeIO.cpp index 4cff8cb90bb..23dbe1fbe57 100644 --- a/cpp/tests/io/OctreeIO.cpp +++ b/cpp/tests/io/OctreeIO.cpp @@ -76,7 +76,7 @@ TEST(OctreeIO, ZeroDepth) { TEST(OctreeIO, JsonFileIOFragment) { // Create octree geometry::PointCloud pcd; - data::SamplePointCloudPLY pointcloud_ply; + data::PLYPointCloud pointcloud_ply; io::ReadPointCloud(pointcloud_ply.GetPath(), pcd); size_t max_depth = 6; geometry::Octree octree(max_depth); diff --git a/cpp/tests/pipelines/integration/UniformTSDFVolume.cpp b/cpp/tests/pipelines/integration/UniformTSDFVolume.cpp index 16c048507b2..261868b5178 100644 --- a/cpp/tests/pipelines/integration/UniformTSDFVolume.cpp +++ b/cpp/tests/pipelines/integration/UniformTSDFVolume.cpp @@ -101,7 +101,7 @@ TEST(UniformTSDFVolume, Constructor) { TEST(UniformTSDFVolume, RealData) { // Poses - data::SampleRGBDDatasetRedwood redwood_data; + data::SampleRedwoodRGBDImages redwood_data; std::string trajectory_path = redwood_data.GetOdometryLogPath(); std::vector poses; if (!ReadPoses(trajectory_path, poses)) { diff --git a/cpp/tests/t/geometry/Image.cpp b/cpp/tests/t/geometry/Image.cpp index 36cdf2c4694..49a55539f6c 100644 --- a/cpp/tests/t/geometry/Image.cpp +++ b/cpp/tests/t/geometry/Image.cpp @@ -856,7 +856,7 @@ TEST_P(ImagePermuteDevices, DepthToVertexNormalMaps) { TEST_P(ImagePermuteDevices, DISABLED_CreateVertexMap_Visual) { core::Device device = GetParam(); - data::SampleRGBDDatasetRedwood redwood_data; + data::SampleRedwoodRGBDImages redwood_data; t::geometry::Image depth = t::io::CreateImageFromFile(redwood_data.GetDepthPaths()[0]) ->To(device); @@ -873,7 +873,7 @@ TEST_P(ImagePermuteDevices, DISABLED_CreateVertexMap_Visual) { TEST_P(ImagePermuteDevices, DISABLED_CreateNormalMap_Visual) { core::Device device = GetParam(); - data::SampleRGBDDatasetRedwood redwood_data; + data::SampleRedwoodRGBDImages redwood_data; t::geometry::Image depth = t::io::CreateImageFromFile(redwood_data.GetDepthPaths()[0]) ->To(device); @@ -905,7 +905,7 @@ TEST_P(ImagePermuteDevices, DISABLED_CreateNormalMap_Visual) { TEST_P(ImagePermuteDevices, DISABLED_ColorizeDepth) { core::Device device = GetParam(); - data::SampleRGBDDatasetRedwood redwood_data; + data::SampleRedwoodRGBDImages redwood_data; t::geometry::Image depth = t::io::CreateImageFromFile(redwood_data.GetDepthPaths()[0]) ->To(device); diff --git a/cpp/tests/t/geometry/PointCloud.cpp b/cpp/tests/t/geometry/PointCloud.cpp index 4b6f0e37d92..ca6cb32078a 100644 --- a/cpp/tests/t/geometry/PointCloud.cpp +++ b/cpp/tests/t/geometry/PointCloud.cpp @@ -673,7 +673,7 @@ TEST_P(PointCloudPermuteDevices, CreateFromRGBDOrDepthImageWithNormals) { TEST_P(PointCloudPermuteDevices, VoxelDownSample) { core::Device device = GetParam(); - data::SamplePointCloudPCD sample_pcd; + data::PCDPointCloud sample_pcd; // Sanity test to visualize t::geometry::PointCloud pcd = t::geometry::PointCloud::FromLegacy( diff --git a/cpp/tests/t/geometry/VoxelBlockGrid.cpp b/cpp/tests/t/geometry/VoxelBlockGrid.cpp index 30b720aad29..cbadb69e6fe 100644 --- a/cpp/tests/t/geometry/VoxelBlockGrid.cpp +++ b/cpp/tests/t/geometry/VoxelBlockGrid.cpp @@ -29,6 +29,7 @@ #include "core/CoreTest.h" #include "open3d/core/EigenConverter.h" #include "open3d/core/Tensor.h" +#include "open3d/data/Dataset.h" #include "open3d/io/PinholeCameraTrajectoryIO.h" #include "open3d/io/TriangleMeshIO.h" #include "open3d/t/io/ImageIO.h" @@ -58,11 +59,11 @@ static core::Tensor GetIntrinsicTensor() { } static std::vector GetExtrinsicTensors() { + data::SampleRedwoodRGBDImages redwood_data; + // Extrinsics - std::string trajectory_path = - std::string(TEST_DATA_DIR) + "/RGBD/odometry.log"; - auto trajectory = - io::CreatePinholeCameraTrajectoryFromFile(trajectory_path); + auto trajectory = io::CreatePinholeCameraTrajectoryFromFile( + redwood_data.GetOdometryLogPath()); std::vector extrinsics; for (size_t i = 0; i < trajectory->parameters_.size(); ++i) { @@ -102,15 +103,14 @@ static VoxelBlockGrid Integrate(const core::HashBackendType &backend, {core::Float32, dtype, dtype}, {{1}, {1}, {3}}, 3.0 / 512, resolution, 10000, device, backend); + data::SampleRedwoodRGBDImages redwood_data; for (size_t i = 0; i < extrinsics.size(); ++i) { - Image depth = t::io::CreateImageFromFile( - fmt::format("{}/RGBD/depth/{:05d}.png", - std::string(TEST_DATA_DIR), i)) - ->To(device); - Image color = t::io::CreateImageFromFile( - fmt::format("{}/RGBD/color/{:05d}.jpg", - std::string(TEST_DATA_DIR), i)) - ->To(device); + Image depth = + t::io::CreateImageFromFile(redwood_data.GetDepthPaths()[i]) + ->To(device); + Image color = + t::io::CreateImageFromFile(redwood_data.GetColorPaths()[i]) + ->To(device); core::Tensor frustum_block_coords = vbg.GetUniqueBlockCoordinates( depth, intrinsic, extrinsics[i], depth_scale, depth_max, @@ -153,11 +153,11 @@ TEST_P(VoxelBlockGridPermuteDevices, Exceptions) { std::vector extrinsics = GetExtrinsicTensors(); float depth_scale = 1000.0; float depth_max = 3.0; - Image depth = *t::io::CreateImageFromFile( - fmt::format("{}/RGBD/depth/00000.png", std::string(TEST_DATA_DIR))); - Image color = *t::io::CreateImageFromFile( - fmt::format("{}/RGBD/color/00000.jpg", std::string(TEST_DATA_DIR))); + data::SampleRedwoodRGBDImages redwood_data; + Image depth = *t::io::CreateImageFromFile(redwood_data.GetDepthPaths()[0]); + + Image color = *t::io::CreateImageFromFile(redwood_data.GetColorPaths()[0]); auto vbg = VoxelBlockGrid(); EXPECT_THROW(vbg.GetUniqueBlockCoordinates(depth, intrinsic, extrinsics[0], @@ -229,10 +229,10 @@ TEST_P(VoxelBlockGridPermuteDevices, GetUniqueBlockCoordinates) { backend); const int i = 0; - Image depth = t::io::CreateImageFromFile( - fmt::format("{}/RGBD/depth/{:05d}.png", - std::string(TEST_DATA_DIR), i)) - ->To(device); + data::SampleRedwoodRGBDImages redwood_data; + Image depth = + t::io::CreateImageFromFile(redwood_data.GetDepthPaths()[i]) + ->To(device); core::Tensor block_coords_from_depth = vbg.GetUniqueBlockCoordinates( depth, intrinsic, extrinsics[i], depth_scale, depth_max, trunc_voxel_multiplier); @@ -322,10 +322,10 @@ TEST_P(VoxelBlockGridPermuteDevices, RayCasting) { int i = extrinsics.size() - 1; - Image depth = t::io::CreateImageFromFile( - fmt::format("{}/RGBD/depth/{:05d}.png", - std::string(TEST_DATA_DIR), i)) - ->To(device); + data::SampleRedwoodRGBDImages redwood_data; + Image depth = + t::io::CreateImageFromFile(redwood_data.GetDepthPaths()[i]) + ->To(device); core::Tensor frustum_block_coords = vbg.GetUniqueBlockCoordinates( depth, intrinsic, extrinsics[i], depth_scale, depth_max); @@ -380,11 +380,10 @@ TEST_P(VoxelBlockGridPermuteDevices, DISABLED_RayCastingVisualize) { /* block_resolution = */ 8); int i = extrinsics.size() - 1; - - Image depth = t::io::CreateImageFromFile( - fmt::format("{}/RGBD/depth/{:05d}.png", - std::string(TEST_DATA_DIR), i)) - ->To(device); + data::SampleRedwoodRGBDImages redwood_data; + Image depth = + t::io::CreateImageFromFile(redwood_data.GetDepthPaths()[i]) + ->To(device); core::Tensor frustum_block_coords = vbg.GetUniqueBlockCoordinates( depth, intrinsic, extrinsics[i], depth_scale, depth_max); diff --git a/cpp/tests/t/io/PointCloudIO.cpp b/cpp/tests/t/io/PointCloudIO.cpp index 51c63502116..b7c06606f02 100644 --- a/cpp/tests/t/io/PointCloudIO.cpp +++ b/cpp/tests/t/io/PointCloudIO.cpp @@ -155,7 +155,7 @@ TEST_P(ReadWriteTPC, WriteBadData) { TEST(TPointCloudIO, ReadPointCloudFromPLY1) { t::geometry::PointCloud pcd; - data::SamplePointCloudPLY pointcloud_ply; + data::PLYPointCloud pointcloud_ply; t::io::ReadPointCloud(pointcloud_ply.GetPath(), pcd, {"auto", false, false, true}); EXPECT_EQ(pcd.GetPointPositions().GetLength(), 196133); @@ -316,7 +316,7 @@ TEST(TPointCloudIO, WritePTSColorConversion2) { TEST(TPointCloudIO, ReadWritePointCloudAsNPZ) { // Read PointCloud from PLY file. t::geometry::PointCloud pcd_ply; - data::SamplePointCloudPLY pointcloud_ply; + data::PLYPointCloud pointcloud_ply; t::io::ReadPointCloud(pointcloud_ply.GetPath(), pcd_ply, {"auto", false, false, true}); @@ -352,7 +352,7 @@ TEST(TPointCloudIO, ReadWritePointCloudAsPCD) { // Read PointCloud from PLY file. t::geometry::PointCloud input_pcd; // Using PLY Read to load the data. - data::SamplePointCloudPLY pointcloud_ply; + data::PLYPointCloud pointcloud_ply; t::io::ReadPointCloud(pointcloud_ply.GetPath(), input_pcd, {"auto", false, false, false}); diff --git a/cpp/tests/t/pipelines/odometry/RGBDOdometry.cpp b/cpp/tests/t/pipelines/odometry/RGBDOdometry.cpp index 16f75c045bf..6d66186b8ac 100644 --- a/cpp/tests/t/pipelines/odometry/RGBDOdometry.cpp +++ b/cpp/tests/t/pipelines/odometry/RGBDOdometry.cpp @@ -66,7 +66,7 @@ TEST_P(OdometryPermuteDevices, ComputeOdometryResultPointToPlane) { const float depth_scale = 1000.0; const float depth_diff = 0.07; - data::SampleRGBDDatasetRedwood redwood_data; + data::SampleRedwoodRGBDImages redwood_data; t::geometry::Image src_depth = *t::io::CreateImageFromFile(redwood_data.GetDepthPaths()[0]); t::geometry::Image dst_depth = @@ -135,7 +135,7 @@ TEST_P(OdometryPermuteDevices, RGBDOdometryMultiScalePointToPlane) { const float depth_max = 3.0; const float depth_diff = 0.07; - data::SampleRGBDDatasetRedwood redwood_data; + data::SampleRedwoodRGBDImages redwood_data; t::geometry::Image src_depth = *t::io::CreateImageFromFile(redwood_data.GetDepthPaths()[0]); t::geometry::Image dst_depth = @@ -203,7 +203,7 @@ TEST_P(OdometryPermuteDevices, RGBDOdometryMultiScaleIntensity) { const float depth_max = 3.0; const float depth_diff = 0.07; - data::SampleRGBDDatasetRedwood redwood_data; + data::SampleRedwoodRGBDImages redwood_data; t::geometry::Image src_depth = *t::io::CreateImageFromFile(redwood_data.GetDepthPaths()[0]); t::geometry::Image dst_depth = @@ -271,7 +271,7 @@ TEST_P(OdometryPermuteDevices, RGBDOdometryMultiScaleHybrid) { const float depth_max = 3.0; const float depth_diff = 0.07; - data::SampleRGBDDatasetRedwood redwood_data; + data::SampleRedwoodRGBDImages redwood_data; t::geometry::Image src_depth = *t::io::CreateImageFromFile(redwood_data.GetDepthPaths()[0]); t::geometry::Image dst_depth = diff --git a/cpp/tests/t/pipelines/registration/Registration.cpp b/cpp/tests/t/pipelines/registration/Registration.cpp index bbab7b69aa9..097acb7761e 100644 --- a/cpp/tests/t/pipelines/registration/Registration.cpp +++ b/cpp/tests/t/pipelines/registration/Registration.cpp @@ -30,6 +30,7 @@ #include "open3d/core/Dispatch.h" #include "open3d/core/EigenConverter.h" #include "open3d/core/Tensor.h" +#include "open3d/data/Dataset.h" #include "open3d/pipelines/registration/ColoredICP.h" #include "open3d/pipelines/registration/Registration.h" #include "open3d/pipelines/registration/RobustKernel.h" @@ -314,12 +315,9 @@ TEST_P(RegistrationPermuteDevices, RegistrationColoredICP) { core::Device device = GetParam(); t::geometry::PointCloud source_tpcd, target_tpcd; - t::io::ReadPointCloud( - std::string(TEST_DATA_DIR) + "/ColoredICP/frag_115.ply", - source_tpcd); - t::io::ReadPointCloud( - std::string(TEST_DATA_DIR) + "/ColoredICP/frag_116.ply", - target_tpcd); + data::DemoColoredICPPointClouds colored_frag; + t::io::ReadPointCloud(colored_frag.GetPaths()[0], source_tpcd); + t::io::ReadPointCloud(colored_frag.GetPaths()[1], target_tpcd); source_tpcd = source_tpcd.To(device); target_tpcd = target_tpcd.To(device); diff --git a/cpp/tests/t/pipelines/slac/ControlGrid.cpp b/cpp/tests/t/pipelines/slac/ControlGrid.cpp index 96c132ae292..e56896b6f76 100644 --- a/cpp/tests/t/pipelines/slac/ControlGrid.cpp +++ b/cpp/tests/t/pipelines/slac/ControlGrid.cpp @@ -53,7 +53,7 @@ TEST_P(ControlGridPermuteDevices, Touch) { core::Device device = GetParam(); t::pipelines::slac::ControlGrid cgrid(0.5, 1000, device); - data::SamplePointCloudPCD sample_pcd; + data::PCDPointCloud sample_pcd; t::geometry::PointCloud pcd = CreateTPCDFromFile(sample_pcd.GetPath(), device); cgrid.Touch(pcd); @@ -65,7 +65,7 @@ TEST_P(ControlGridPermuteDevices, Deform) { core::Device device = GetParam(); t::pipelines::slac::ControlGrid cgrid(0.5, 1000, device); - data::SamplePointCloudPCD sample_pcd; + data::PCDPointCloud sample_pcd; t::geometry::PointCloud pcd = CreateTPCDFromFile(sample_pcd.GetPath(), device); cgrid.Touch(pcd); @@ -84,7 +84,7 @@ TEST_P(ControlGridPermuteDevices, Regularizer) { core::Device device = GetParam(); t::pipelines::slac::ControlGrid cgrid(0.5, 1000, device); - data::SamplePointCloudPCD sample_pcd; + data::PCDPointCloud sample_pcd; t::geometry::PointCloud pcd = CreateTPCDFromFile(sample_pcd.GetPath(), device); cgrid.Touch(pcd); diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 01422ffb0dc..564546e58a0 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -21,5 +21,5 @@ if(NOT ext_open3d_sphinx_theme_POPULATED) set(OPEN3D_SPHINX_THEME_SOURCE_DIR ${ext_open3d_sphinx_theme_SOURCE_DIR}) endif() -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/conf.in.py ${CMAKE_CURRENT_SOURCE_DIR}/conf.py @ONLY) diff --git a/docs/conf.py.in b/docs/conf.in.py similarity index 100% rename from docs/conf.py.in rename to docs/conf.in.py diff --git a/docs/index.rst b/docs/index.rst index d54da3724c6..70050689bfe 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -40,6 +40,7 @@ Open3D: A Modern Library for 3D Data Processing tutorial/t_pipelines/index tutorial/visualization/index tutorial/core/index + tutorial/data/index tutorial/reconstruction_system/index tutorial/t_reconstruction_system/index tutorial/sensor/index diff --git a/docs/jupyter/geometry/file_io.ipynb b/docs/jupyter/geometry/file_io.ipynb index 6f77c93a859..7e943f03e25 100644 --- a/docs/jupyter/geometry/file_io.ipynb +++ b/docs/jupyter/geometry/file_io.ipynb @@ -43,7 +43,7 @@ "outputs": [], "source": [ "print(\"Testing IO for point cloud ...\")\n", - "sample_pcd_data = o3d.data.SamplePointCloudPCD()\n", + "sample_pcd_data = o3d.data.PCDPointCloud()\n", "pcd = o3d.io.read_point_cloud(sample_pcd_data.path)\n", "print(pcd)\n", "o3d.io.write_point_cloud(\"copy_of_fragment.pcd\", pcd)" diff --git a/docs/jupyter/geometry/kdtree.ipynb b/docs/jupyter/geometry/kdtree.ipynb index c7048d7a669..ef23c8b604d 100644 --- a/docs/jupyter/geometry/kdtree.ipynb +++ b/docs/jupyter/geometry/kdtree.ipynb @@ -45,7 +45,7 @@ "print(\"Testing kdtree in Open3D...\")\n", "print(\"Load a point cloud and paint it gray.\")\n", "\n", - "sample_pcd_data = o3d.data.SamplePointCloudPCD()\n", + "sample_pcd_data = o3d.data.PCDPointCloud()\n", "pcd = o3d.io.read_point_cloud(sample_pcd_data.path)\n", "pcd.paint_uniform_color([0.5, 0.5, 0.5])\n", "pcd_tree = o3d.geometry.KDTreeFlann(pcd)" diff --git a/docs/jupyter/geometry/pointcloud.ipynb b/docs/jupyter/geometry/pointcloud.ipynb index d9183d5bf3e..e7c96221827 100644 --- a/docs/jupyter/geometry/pointcloud.ipynb +++ b/docs/jupyter/geometry/pointcloud.ipynb @@ -40,8 +40,8 @@ "outputs": [], "source": [ "print(\"Load a ply point cloud, print it, and render it\")\n", - "sample_pointcloud_ply = o3d.data.SamplePointCloudPLY()\n", - "pcd = o3d.io.read_point_cloud(sample_pointcloud_ply.path)\n", + "ply_point_cloud = o3d.data.PLYPointCloud()\n", + "pcd = o3d.io.read_point_cloud(ply_point_cloud.path)\n", "print(pcd)\n", "print(np.asarray(pcd.points))\n", "o3d.visualization.draw_geometries([pcd],\n", @@ -204,7 +204,7 @@ "source": [ "print(\"Load a polygon volume and use it to crop the original point cloud\")\n", "demo_crop_data = o3d.data.DemoCropPointCloud()\n", - "pcd = o3d.io.read_point_cloud(demo_crop_data.pointcloud_path)\n", + "pcd = o3d.io.read_point_cloud(demo_crop_data.point_cloud_path)\n", "vol = o3d.visualization.read_selection_polygon_volume(demo_crop_data.cropped_json_path)\n", "chair = vol.crop_point_cloud(pcd)\n", "o3d.visualization.draw_geometries([chair],\n", @@ -268,7 +268,7 @@ "source": [ "# Load data\n", "demo_crop_data = o3d.data.DemoCropPointCloud()\n", - "pcd = o3d.io.read_point_cloud(demo_crop_data.pointcloud_path)\n", + "pcd = o3d.io.read_point_cloud(demo_crop_data.point_cloud_path)\n", "vol = o3d.visualization.read_selection_polygon_volume(demo_crop_data.cropped_json_path)\n", "chair = vol.crop_point_cloud(pcd)\n", "\n", @@ -349,8 +349,8 @@ "metadata": {}, "outputs": [], "source": [ - "sample_pointcloud_ply = o3d.data.SamplePointCloudPLY()\n", - "pcd = o3d.io.read_point_cloud(sample_pointcloud_ply.path)\n", + "ply_point_cloud = o3d.data.PLYPointCloud()\n", + "pcd = o3d.io.read_point_cloud(ply_point_cloud.path)\n", "\n", "with o3d.utility.VerbosityContextManager(\n", " o3d.utility.VerbosityLevel.Debug) as cm:\n", @@ -396,8 +396,8 @@ "metadata": {}, "outputs": [], "source": [ - "sample_pointcloud_pcd = o3d.data.SamplePointCloudPCD()\n", - "pcd = o3d.io.read_point_cloud(sample_pointcloud_pcd.path)\n", + "pcd_point_cloud = o3d.data.PCDPointCloud()\n", + "pcd = o3d.io.read_point_cloud(pcd_point_cloud.path)\n", "\n", "plane_model, inliers = pcd.segment_plane(distance_threshold=0.01,\n", " ransac_n=3,\n", @@ -462,7 +462,7 @@ "metadata": { "celltoolbar": "Edit Metadata", "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -476,9 +476,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.7" + "version": "3.8.11" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/docs/jupyter/geometry/pointcloud_outlier_removal.ipynb b/docs/jupyter/geometry/pointcloud_outlier_removal.ipynb index 834354c631a..2ca1b52b55f 100644 --- a/docs/jupyter/geometry/pointcloud_outlier_removal.ipynb +++ b/docs/jupyter/geometry/pointcloud_outlier_removal.ipynb @@ -43,7 +43,7 @@ "outputs": [], "source": [ "print(\"Load a ply point cloud, print it, and render it\")\n", - "sample_pcd_data = o3d.data.SamplePointCloudPCD()\n", + "sample_pcd_data = o3d.data.PCDPointCloud()\n", "pcd = o3d.io.read_point_cloud(sample_pcd_data.path)\n", "o3d.visualization.draw_geometries([pcd],\n", " zoom=0.3412,\n", diff --git a/docs/jupyter/geometry/python_interface.ipynb b/docs/jupyter/geometry/python_interface.ipynb index c0e93f0d5e6..b0b46d0adb1 100644 --- a/docs/jupyter/geometry/python_interface.ipynb +++ b/docs/jupyter/geometry/python_interface.ipynb @@ -50,7 +50,7 @@ "metadata": {}, "outputs": [], "source": [ - "sample_pcd_data = o3d.data.SamplePointCloudPCD()\n", + "sample_pcd_data = o3d.data.PCDPointCloud()\n", "pcd = o3d.io.read_point_cloud(sample_pcd_data.path)\n", "print(pcd)" ] diff --git a/docs/jupyter/geometry/rgbd_image.ipynb b/docs/jupyter/geometry/rgbd_image.ipynb index b316cb51636..439223dee43 100644 --- a/docs/jupyter/geometry/rgbd_image.ipynb +++ b/docs/jupyter/geometry/rgbd_image.ipynb @@ -48,7 +48,7 @@ "outputs": [], "source": [ "print(\"Read Redwood dataset\")\n", - "redwood_rgbd = o3d.data.SampleRGBDDatasetRedwood()\n", + "redwood_rgbd = o3d.data.SampleRedwoodRGBDImages()\n", "color_raw = o3d.io.read_image(redwood_rgbd.color_paths[0])\n", "depth_raw = o3d.io.read_image(redwood_rgbd.depth_paths[0])\n", "rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth(\n", @@ -126,7 +126,7 @@ "outputs": [], "source": [ "print(\"Read SUN dataset\")\n", - "sun_rgbd = o3d.data.SampleRGBDImageSUN()\n", + "sun_rgbd = o3d.data.SampleSUNRGBDImage()\n", "color_raw = o3d.io.read_image(sun_rgbd.color_path)\n", "depth_raw = o3d.io.read_image(sun_rgbd.depth_path)\n", "rgbd_image = o3d.geometry.RGBDImage.create_from_sun_format(color_raw, depth_raw)\n", @@ -207,7 +207,7 @@ "print(\"Read NYU dataset\")\n", "# Open3D does not support ppm/pgm file yet. Not using o3d.io.read_image here.\n", "# MathplotImage having some ISSUE with NYU pgm file. Not using imread for pgm.\n", - "nyu_rgbd = o3d.data.SampleRGBDImageNYU()\n", + "nyu_rgbd = o3d.data.SampleNYURGBDImage()\n", "color_raw = mpimg.imread(nyu_rgbd.color_path)\n", "depth_raw = read_nyu_pgm(nyu_rgbd.depth_path)\n", "color = o3d.geometry.Image(color_raw)\n", @@ -263,7 +263,7 @@ "outputs": [], "source": [ "print(\"Read TUM dataset\")\n", - "tum_rgbd = o3d.data.SampleRGBDImageSUN()\n", + "tum_rgbd = o3d.data.SampleSUNRGBDImage()\n", "color_raw = o3d.io.read_image(tum_rgbd.color_path)\n", "depth_raw = o3d.io.read_image(tum_rgbd.depth_path)\n", "rgbd_image = o3d.geometry.RGBDImage.create_from_tum_format(color_raw, depth_raw)\n", @@ -304,7 +304,7 @@ "metadata": { "celltoolbar": "Edit Metadata", "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -318,9 +318,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.7" + "version": "3.8.11" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/docs/jupyter/pipelines/color_map_optimization.ipynb b/docs/jupyter/pipelines/color_map_optimization.ipynb index d6929f97c28..5eb355deb6b 100644 --- a/docs/jupyter/pipelines/color_map_optimization.ipynb +++ b/docs/jupyter/pipelines/color_map_optimization.ipynb @@ -49,7 +49,7 @@ "source": [ "def load_fountain_dataset():\n", " rgbd_images = []\n", - " fountain_rgbd_dataset = o3d.data.SampleFountainRGBDDataset()\n", + " fountain_rgbd_dataset = o3d.data.SampleFountainRGBDImages()\n", " for i in range(len(fountain_rgbd_dataset.depth_paths)):\n", " depth = o3d.io.read_image(fountain_rgbd_dataset.depth_paths[i])\n", " color = o3d.io.read_image(fountain_rgbd_dataset.color_paths[i])\n", diff --git a/docs/jupyter/pipelines/rgbd_integration.ipynb b/docs/jupyter/pipelines/rgbd_integration.ipynb index 50059a9552f..332e94f1349 100644 --- a/docs/jupyter/pipelines/rgbd_integration.ipynb +++ b/docs/jupyter/pipelines/rgbd_integration.ipynb @@ -88,7 +88,7 @@ "metadata": {}, "outputs": [], "source": [ - "redwood_rgbd = o3d.data.SampleRGBDDatasetRedwood()\n", + "redwood_rgbd = o3d.data.SampleRedwoodRGBDImages()\n", "camera_poses = read_trajectory(redwood_rgbd.odometry_log_path)" ] }, diff --git a/docs/jupyter/pipelines/rgbd_odometry.ipynb b/docs/jupyter/pipelines/rgbd_odometry.ipynb index 59040cb06a9..a8e2937a97e 100644 --- a/docs/jupyter/pipelines/rgbd_odometry.ipynb +++ b/docs/jupyter/pipelines/rgbd_odometry.ipynb @@ -74,7 +74,7 @@ "metadata": {}, "outputs": [], "source": [ - "redwood_rgbd = o3d.data.SampleRGBDDatasetRedwood()\n", + "redwood_rgbd = o3d.data.SampleRedwoodRGBDImages()\n", "\n", "source_color = o3d.io.read_image(redwood_rgbd.color_paths[0])\n", "source_depth = o3d.io.read_image(redwood_rgbd.depth_paths[0])\n", diff --git a/docs/jupyter/visualization/visualization.ipynb b/docs/jupyter/visualization/visualization.ipynb index 1de10e0ee82..a2a32cf14ce 100644 --- a/docs/jupyter/visualization/visualization.ipynb +++ b/docs/jupyter/visualization/visualization.ipynb @@ -36,7 +36,7 @@ "outputs": [], "source": [ "print(\"Load a ply point cloud, print it, and render it\")\n", - "sample_ply_data = o3d.data.SamplePointCloudPLY()\n", + "sample_ply_data = o3d.data.PLYPointCloud()\n", "pcd = o3d.io.read_point_cloud(sample_ply_data.path)\n", "o3d.visualization.draw_geometries([pcd],\n", " zoom=0.3412,\n", diff --git a/docs/make_docs.py b/docs/make_docs.py index 5e579b895d9..c2d198f4216 100644 --- a/docs/make_docs.py +++ b/docs/make_docs.py @@ -507,7 +507,8 @@ def run(self): 'jupyter_visualization.ipynb' ] example_dirs = [ - "geometry", "core", "pipelines", "visualization", "t_pipelines" + "geometry", "core", "data", "pipelines", "visualization", + "t_pipelines" ] for example_dir in example_dirs: in_dir = (Path(self.current_file_dir) / "jupyter" / example_dir) diff --git a/docs/tutorial/data/index.rst b/docs/tutorial/data/index.rst new file mode 100644 index 00000000000..a5fe8cc6e55 --- /dev/null +++ b/docs/tutorial/data/index.rst @@ -0,0 +1,481 @@ +.. _dataset: + +Dataset +======= + +Open3D comes with a built-in dataset module for convenient access to commonly +used example datasets. These datasets will downloaded automatically from the +internet. + +.. code-block:: python + + import open3d as o3d + + if __name__ == "__main__": + dataset = o3d.data.EaglePointCloud() + pcd = o3d.io.read_point_cloud(dataset.path) + o3d.visualization.draw(pcd) + +.. code-block:: cpp + + #include + #include + #include "open3d/Open3D.h" + + int main() { + using namespace open3d; + + data::EaglePointCloud dataset; + auto pcd = io::CreatePointCloudFromFile(dataset.GetPath()); + visualization::Draw({pcd}); + + return 0; + } + +- Datasets are downloaded can cached automatically. The default data root is + ``~/open3d_data``. Data will be downloaded to ``~/open3d_data/download`` + and extracted to ``~/open3d_data/extract``. +- Optionally, you can change the default data root. This can be done by setting + the environment variable ``OPEN3D_DATA_ROOT`` or passing the ``data_root`` + argument when constructing a dataset object. + +PointCloud +~~~~~~~~~~ + +PCDPointCloud +------------------- + +Colored point cloud of a living room from the Redwood dataset in PCD format. + +.. code-block:: python + + dataset = o3d.data.PCDPointCloud() + pcd = o3d.io.read_point_cloud(dataset.path) + +.. code-block:: cpp + + data::PCDPointCloud dataset; + auto pcd = io::CreatePointCloudFromFile(dataset.GetPath()); + +PLYPointCloud +------------------- + +Colored point cloud of a living room from the Redwood dataset in PLY format. + +.. code-block:: python + + dataset = o3d.data.PLYPointCloud() + pcd = o3d.io.read_point_cloud(dataset.path) + +.. code-block:: cpp + + data::PLYPointCloud dataset; + auto pcd = io::CreatePointCloudFromFile(dataset.GetPath()); + +EaglePointCloud +--------------- + +Eagle colored point cloud. + +.. code-block:: python + + dataset = o3d.data.EaglePointCloud() + pcd = o3d.io.read_point_cloud(dataset.path) + +.. code-block:: cpp + + data::EaglePointCloud dataset; + auto pcd = io::CreatePointCloudFromFile(dataset.GetPath()); + +LivingRoomPointClouds +---------------------------- + +57 point clouds of binary PLY format from the Redwood RGB-D Dataset. + +.. code-block:: python + + dataset = o3d.data.LivingRoomPointClouds() + pcds = [] + for pcd_path in dataset.paths: + pcds.append(o3d.io.read_point_cloud(pcd_path)) + +.. code-block:: cpp + + data::LivingRoomPointClouds dataset; + std::vector> pcds; + for (const std::string& pcd_path: dataset.GetPaths()) { + pcds.push_back(io::CreatePointCloudFromFile(pcd_path)); + } + +OfficePointClouds +------------------------ + +53 point clouds of binary PLY format from Redwood RGB-D Dataset. + +.. code-block:: python + + dataset = o3d.data.OfficePointClouds() + pcds = [] + for pcd_path in dataset.paths: + pcds.append(o3d.io.read_point_cloud(pcd_path)) + +.. code-block:: cpp + + data::OfficePointClouds dataset; + std::vector> pcds; + for (const std::string& pcd_path: dataset.GetPaths()) { + pcds.push_back(io::CreatePointCloudFromFile(pcd_path)); + } + +TriangleMesh +~~~~~~~~~~~~ + +BunnyMesh +--------- + +The bunny triangle mesh from Stanford in PLY format. + +.. code-block:: python + + dataset = o3d.data.BunnyMesh() + mesh = o3d.io.read_triangle_mesh(dataset.path) + +.. code-block:: cpp + + data::BunnyMesh dataset; + auto mesh = io::CreateMeshFromFile(dataset.GetPath()); + +ArmadilloMesh +------------- + +The armadillo mesh from Stanford in PLY format. + +.. code-block:: python + + dataset = o3d.data.ArmadilloMesh() + mesh = o3d.io.read_triangle_mesh(dataset.path) + +.. code-block:: cpp + + data::ArmadilloMesh dataset; + auto mesh = io::CreateMeshFromFile(dataset.GetPath()); + +KnotMesh +-------- + +A 3D Mobius knot mesh in PLY format. + +.. code-block:: python + + dataset = o3d.data.KnotMesh() + mesh = o3d.io.read_triangle_mesh(dataset.path) + +.. code-block:: cpp + + data::KnotMesh dataset; + auto mesh = io::CreateMeshFromFile(dataset.GetPath()); + +Image +~~~~~ + +JuneauImage +----------- + +The RGB image ``JuneauImage.jpg`` file. + +.. code-block:: python + + img_data = o3d.data.JuneauImage() + img = o3d.io.read_image(img_data.path) + +.. code-block:: cpp + + data::JuneauImage img_data; + auto img = io::CreateImageFromFile(img_data.path); + +RGBDImage +~~~~~~~~~ + +SampleRedwoodRGBDImages +------------------------ + +Sample set of 5 color images, 5 depth images from the Redwood RGBD +living-room1 dataset. It also contains a camera trajectory log, a camera +odometry log, an rgbd match file, and a point cloud reconstruction obtained from +TSDF. + +.. code-block:: python + + dataset = o3d.data.SampleRedwoodRGBDImages() + + rgbd_images = [] + for i in range(len(dataset.depth_paths)): + color_raw = o3d.io.read_image(dataset.color_paths[i]) + depth_raw = o3d.io.read_image(dataset.depth_paths[i]) + rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth( + color_raw, depth_raw) + rgbd_images.append(rgbd_image) + + pcd = o3d.io.read_point_cloud(dataset.reconstruction_path) + +.. code-block:: cpp + + data::SampleRedwoodRGBDImages dataset; + + std::vector> rgbd_images; + for(size_t i = 0; i < dataset.GetDepthPaths().size(); ++i) { + auto color_raw = io::CreateImageFromFile(dataset.GetColorPaths()[i]); + auto depth_raw = io::CreateImageFromFile(dataset.GetDepthPaths()[i]); + + auto rgbd_image = geometry::RGBDImage::CreateFromColorAndDepth( + *color_raw, *depth_raw, + /*depth_scale =*/1000.0, + /*depth_trunc =*/3.0, + /*convert_rgb_to_intensity =*/false); + rgbd_images.push_back(rgbd_image); + } + + auto pcd = io::CreatePointCloudFromFile(dataset.GetReconstructionPath()); + +SampleFountainRGBDImages +------------------------- + +Sample set of 33 color and depth images from the Fountain RGBD dataset. +It also contains camera poses at key frames log and mesh reconstruction. + +.. code-block:: python + + dataset = o3d.data.SampleFountainRGBDImages() + + rgbd_images = [] + for i in range(len(dataset.depth_paths)): + depth = o3d.io.read_image(dataset.depth_paths[i]) + color = o3d.io.read_image(dataset.color_paths[i]) + rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth( + color, depth, convert_rgb_to_intensity=False) + rgbd_images.append(rgbd_image) + + camera_trajectory = o3d.io.read_pinhole_camera_trajectory( + dataset.keyframe_poses_log_path) + mesh = o3d.io.read_triangle_mesh(dataset.reconstruction_path) + +.. code-block:: cpp + + data::SampleFountainRGBDImages dataset; + + std::vector> rgbd_images; + for(size_t i = 0; i < dataset.GetDepthPaths().size(); ++i) { + auto color_raw = io::CreateImageFromFile(dataset.GetColorPaths()[i]); + auto depth_raw = io::CreateImageFromFile(dataset.GetDepthPaths()[i]); + + auto rgbd_image = geometry::RGBDImage::CreateFromColorAndDepth( + *color_raw, *depth_raw, + /*depth_scale =*/1000.0, + /*depth_trunc =*/3.0, + /*convert_rgb_to_intensity =*/false); + rgbd_images.push_back(rgbd_image); + } + + camera::PinholeCameraTrajectory camera_trajectory; + io::ReadPinholeCameraTrajectory(dataset.GetKeyframePosesLogPath(), + camera_trajectory); + auto mesh = io::CreateMeshFromFile(dataset.GetReconstructionPath()); + +SampleNYURGBDImage +------------------ + +Color image ``NYU_color.ppm`` and depth image ``NYU_depth.pgm`` sample from NYU +RGBD dataset. + +.. code-block:: python + + import matplotlib.image as mpimg + + def read_nyu_pgm(filename, byteorder='>'): + with open(filename, 'rb') as f: + buffer = f.read() + try: + header, width, height, maxval = re.search( + b"(^P5\s(?:\s*#.*[\r\n])*" + b"(\d+)\s(?:\s*#.*[\r\n])*" + b"(\d+)\s(?:\s*#.*[\r\n])*" + b"(\d+)\s(?:\s*#.*[\r\n]\s)*)", buffer).groups() + except AttributeError: + raise ValueError("Not a raw PGM file: '%s'" % filename) + img = np.frombuffer(buffer, + dtype=byteorder + 'u2', + count=int(width) * int(height), + offset=len(header)).reshape((int(height), int(width))) + img_out = img.astype('u2') + return img_out + + dataset = o3d.data.SampleNYURGBDImage() + color_raw = mpimg.imread(dataset.color_path) + depth_raw = read_nyu_pgm(dataset.depth_path) + color = o3d.geometry.Image(color_raw) + depth = o3d.geometry.Image(depth_raw) + rgbd_image = o3d.geometry.RGBDImage.create_from_nyu_format( + color, depth, convert_rgb_to_intensity=False) + +SampleSUNRGBDImage +------------------ + +Color image ``SUN_color.jpg`` and depth image ``SUN_depth.png`` sample from SUN +RGBD dataset. + +.. code-block:: python + + dataset = o3d.data.SampleSUNRGBDImage() + color_raw = o3d.io.read_image(dataset.color_path) + depth_raw = o3d.io.read_image(dataset.depth_path) + rgbd_image = o3d.geometry.RGBDImage.create_from_sun_format( + color_raw, depth_raw, convert_rgb_to_intensity=False) + +.. code-block:: cpp + + data::SampleSUNRGBDImage dataset; + + auto color_raw = io::CreateImageFromFile(dataset.GetColorPath()); + auto depth_raw = io::CreateImageFromFile(dataset.GetDepthPath()); + + auto rgbd_image = geometry::RGBDImage::CreateFromSUNFormat( + *color_raw, *depth_raw, /*convert_rgb_to_intensity =*/ false); + +SampleTUMRGBDImage +------------------ + +Color image ``TUM_color.png`` and depth image ``TUM_depth.png`` sample from TUM +RGBD dataset. + +.. code-block:: python + + dataset = o3d.data.SampleTUMRGBDImage() + color_raw = o3d.io.read_image(dataset.color_path) + depth_raw = o3d.io.read_image(dataset.depth_path) + rgbd_image = o3d.geometry.RGBDImage.create_from_tum_format( + color_raw, depth_raw, convert_rgb_to_intensity=False) + +.. code-block:: cpp + + data::SampleTUMRGBDImage dataset; + + auto color_raw = io::CreateImageFromFile(dataset.GetColorPath()); + auto depth_raw = io::CreateImageFromFile(dataset.GetDepthPath()); + auto rgbd_image = geometry::RGBDImage::CreateFromTUMFormat( + *color_raw, *depth_raw, /*convert_rgb_to_intensity =*/ false); + +Demo +~~~~ + +DemoICPPointClouds +------------------ + +3 point cloud fragments of binary PCD format, from living-room1 scene of Redwood +RGB-D dataset. This data is used for ICP demo. + +.. code-block:: python + + dataset = o3d.data.DemoICPPointClouds() + pcd0 = o3d.io.read_point_cloud(dataset.paths[0]) + pcd1 = o3d.io.read_point_cloud(dataset.paths[1]) + pcd2 = o3d.io.read_point_cloud(dataset.paths[2]) + +.. code-block:: cpp + + data::DemoICPPointClouds dataset; + auto pcd0 = io::CreatePointCloudFromFile(dataset.GetPaths()[0]); + auto pcd1 = io::CreatePointCloudFromFile(dataset.GetPaths()[1]); + auto pcd2 = io::CreatePointCloudFromFile(dataset.GetPaths()[2]); + +DemoColoredICPPointClouds +------------------------- + +2 point cloud fragments of binary PCD format, from apartment scene of Redwood +RGB-D dataset. This data is used for Colored-ICP demo. + +.. code-block:: python + + dataset = o3d.data.DemoColoredICPPointClouds() + pcd0 = o3d.io.read_point_cloud(dataset.paths[0]) + pcd1 = o3d.io.read_point_cloud(dataset.paths[1]) + +.. code-block:: cpp + + data::DemoColoredICPPointClouds dataset; + auto pcd0 = io::CreatePointCloudFromFile(dataset.GetPaths()[0]); + auto pcd1 = io::CreatePointCloudFromFile(dataset.GetPaths()[1]); + +DemoCropPointCloud +------------------ + +Point cloud and ``cropped.json`` (a saved selected polygon volume file). +This data is used for point cloud crop demo. + +.. code-block:: python + + dataset = o3d.data.DemoCropPointCloud() + pcd = o3d.io.read_point_cloud(dataset.point_cloud_path) + vol = o3d.visualization.read_selection_polygon_volume(dataset.cropped_json_path) + chair = vol.crop_point_cloud(pcd) + +.. code-block:: cpp + + data::DemoCropPointCloud dataset; + auto pcd = io::CreatePointCloudFromFile(dataset.GetPointCloudPath()); + visualization::SelectionPolygonVolume vol; + io::ReadIJsonConvertible(dataset.GetCroppedJSONPath(), vol); + auto chair = vol.CropPointCloud(*pcd); + +DemoFeatureMatchingPointClouds +----------------------------- + +Sample set of 2 point cloud fragments and their respective FPFH features and +L32D features. This data is used for point cloud feature matching demo. + +.. code-block:: python + + dataset = o3d.data.DemoFeatureMatchingPointClouds() + + pcd0 = o3d.io.read_point_cloud(dataset.point_cloud_paths[0]) + pcd1 = o3d.io.read_point_cloud(dataset.point_cloud_paths[1]) + + fpfh_feature0 = o3d.io.read_feature(dataset.fpfh_feature_paths[0]) + fpfh_feature1 = o3d.io.read_feature(dataset.fpfh_feature_paths[1]) + + l32d_feature0 = o3d.io.read_feature(dataset.l32d_feature_paths[0]) + l32d_feature1 = o3d.io.read_feature(dataset.l32d_feature_paths[1]) + +.. code-block:: cpp + + data::DemoFeatureMatchingPointClouds dataset; + + auto pcd0 = io::CreatePointCloudFromFile(dataset.GetPointCloudPaths()[0]); + auto pcd1 = io::CreatePointCloudFromFile(dataset.GetPointCloudPaths()[1]); + + pipelines::registration::Feature fpfh_feature0, fpfh_feature1; + io::ReadFeature(dataset.GetFPFHFeaturePaths()[0], fpfh_feature0); + io::ReadFeature(dataset.GetFPFHFeaturePaths()[1], fpfh_feature1); + + pipelines::registration::Feature l32d_feature0, l32d_feature1; + io::ReadFeature(dataset.GetL32DFeaturePaths()[0], l32d_feature0); + io::ReadFeature(dataset.GetL32DFeaturePaths()[1], l32d_feature1); + +DemoPoseGraphOptimization +------------------------- + +Sample fragment pose graph, and global pose graph. This data is used for pose +graph optimization demo. + +.. code-block:: python + + dataset = o3d.data.DemoPoseGraphOptimization() + pose_graph_fragment = o3d.io.read_pose_graph(dataset.pose_graph_fragment_path) + pose_graph_global = o3d.io.read_pose_graph(dataset.pose_graph_global_path) + +.. code-block:: cpp + + data::DemoPoseGraphOptimization dataset; + auto pose_graph_fragment = io::CreatePoseGraphFromFile( + dataset.GetPoseGraphFragmentPath()); + auto pose_graph_global = io::CreatePoseGraphFromFile( + dataset.GetPoseGraphGlobalPath()); diff --git a/examples/cpp/Draw.cpp b/examples/cpp/Draw.cpp index ae24d59660c..bd38e123fd7 100644 --- a/examples/cpp/Draw.cpp +++ b/examples/cpp/Draw.cpp @@ -30,8 +30,6 @@ using namespace open3d; -const std::string TEST_DIR = "../../../examples/test_data"; - double GetRandom() { return double(std::rand()) / double(RAND_MAX); } std::shared_ptr MakePointCloud( @@ -269,12 +267,6 @@ void Selections() { } int main(int argc, char **argv) { - if (!utility::filesystem::DirectoryExists(TEST_DIR)) { - utility::LogError( - "This example needs to be run from the /bin/examples " - "directory"); - } - SingleObject(); MultiObjects(); Actions(); diff --git a/examples/cpp/DrawWebRTC.cpp b/examples/cpp/DrawWebRTC.cpp index 0753787340b..988750f9890 100644 --- a/examples/cpp/DrawWebRTC.cpp +++ b/examples/cpp/DrawWebRTC.cpp @@ -31,9 +31,6 @@ using namespace open3d; -// TODO: remove hard-coded path. -const std::string TEST_DIR = "../../../examples/test_data"; - // Create and add a window to gui::Application, but do not run it yet. void AddDrawWindow( const std::vector> &geometries, @@ -84,7 +81,8 @@ void EmptyBox() { [](visualization::visualizer::O3DVisualizer &o3dvis) { utility::LogInfo("new_window_action called"); auto mesh = std::make_shared(); - io::ReadTriangleMesh(TEST_DIR + "/knot.ply", *mesh); + data::KnotMesh knot_data; + io::ReadTriangleMesh(knot_data.GetPath(), *mesh); mesh->ComputeVertexNormals(); AddDrawWindow({mesh}, "Open3D pcd", 640, 480); }; @@ -129,12 +127,6 @@ void BoxWithObjects() { } int main(int argc, char **argv) { - if (!utility::filesystem::DirectoryExists(TEST_DIR)) { - utility::LogError( - "This example needs to be run from the build directory, " - "test_dir: {}", - TEST_DIR); - } visualization::webrtc_server::WebRTCWindowSystem::GetInstance() ->EnableWebRTC(); diff --git a/examples/python/camera/camera_trajectory.py b/examples/python/camera/camera_trajectory.py index a3507dec450..147c51475f6 100644 --- a/examples/python/camera/camera_trajectory.py +++ b/examples/python/camera/camera_trajectory.py @@ -44,7 +44,7 @@ print("Read a trajectory and combine all the RGB-D images.") pcds = [] - redwood_rgbd = o3d.data.SampleRGBDDatasetRedwood() + redwood_rgbd = o3d.data.SampleRedwoodRGBDImages() trajectory = o3d.io.read_pinhole_camera_trajectory( redwood_rgbd.trajectory_log_path) o3d.io.write_pinhole_camera_trajectory("test.json", trajectory) diff --git a/examples/python/geometry/kd_tree_feature_matching.py b/examples/python/geometry/kd_tree_feature_matching.py index 17b50189fc0..2511032166f 100644 --- a/examples/python/geometry/kd_tree_feature_matching.py +++ b/examples/python/geometry/kd_tree_feature_matching.py @@ -30,9 +30,9 @@ if __name__ == "__main__": print("Load two aligned point clouds.") - demo_data = o3d.data.DemoPointCloudFeatureMatching() - pcd0 = o3d.io.read_point_cloud(demo_data.pointcloud_paths[0]) - pcd1 = o3d.io.read_point_cloud(demo_data.pointcloud_paths[1]) + demo_data = o3d.data.DemoFeatureMatchingPointClouds() + pcd0 = o3d.io.read_point_cloud(demo_data.point_cloud_paths[0]) + pcd1 = o3d.io.read_point_cloud(demo_data.point_cloud_paths[1]) pcd0.paint_uniform_color([1, 0.706, 0]) pcd1.paint_uniform_color([0, 0.651, 0.929]) diff --git a/examples/python/geometry/kd_tree_search.py b/examples/python/geometry/kd_tree_search.py index 36bdcccb807..e5b6c95e370 100644 --- a/examples/python/geometry/kd_tree_search.py +++ b/examples/python/geometry/kd_tree_search.py @@ -31,7 +31,7 @@ def radius_search(): print("Loading pointcloud ...") - sample_pcd_data = o3d.data.SamplePointCloudPCD() + sample_pcd_data = o3d.data.PCDPointCloud() pcd = o3d.io.read_point_cloud(sample_pcd_data.path) pcd_tree = o3d.geometry.KDTreeFlann(pcd) @@ -47,7 +47,7 @@ def radius_search(): def knn_search(): print("Loading pointcloud ...") - sample_pcd = o3d.data.SamplePointCloudPCD() + sample_pcd = o3d.data.PCDPointCloud() pcd = o3d.io.read_point_cloud(sample_pcd.path) pcd_tree = o3d.geometry.KDTreeFlann(pcd) diff --git a/examples/python/geometry/point_cloud_bounding_box.py b/examples/python/geometry/point_cloud_bounding_box.py index 88aab1142fb..fa24126ccab 100644 --- a/examples/python/geometry/point_cloud_bounding_box.py +++ b/examples/python/geometry/point_cloud_bounding_box.py @@ -27,7 +27,7 @@ import open3d as o3d if __name__ == "__main__": - sample_ply_data = o3d.data.SamplePointCloudPLY() + sample_ply_data = o3d.data.PLYPointCloud() pcd = o3d.io.read_point_cloud(sample_ply_data.path) # Flip it, otherwise the pointcloud will be upside down. pcd.transform([[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]]) diff --git a/examples/python/geometry/point_cloud_crop.py b/examples/python/geometry/point_cloud_crop.py index 45bc606ecb2..0a00790051e 100644 --- a/examples/python/geometry/point_cloud_crop.py +++ b/examples/python/geometry/point_cloud_crop.py @@ -29,7 +29,7 @@ if __name__ == "__main__": print("Load a ply point cloud, crop it, and render it") sample_ply_data = o3d.data.DemoCropPointCloud() - pcd = o3d.io.read_point_cloud(sample_ply_data.pointcloud_path) + pcd = o3d.io.read_point_cloud(sample_ply_data.point_cloud_path) vol = o3d.visualization.read_selection_polygon_volume( sample_ply_data.cropped_json_path) chair = vol.crop_point_cloud(pcd) diff --git a/examples/python/geometry/point_cloud_dbscan_clustering.py b/examples/python/geometry/point_cloud_dbscan_clustering.py index 2edc9da288d..b3f10e7775c 100644 --- a/examples/python/geometry/point_cloud_dbscan_clustering.py +++ b/examples/python/geometry/point_cloud_dbscan_clustering.py @@ -29,7 +29,7 @@ import matplotlib.pyplot as plt if __name__ == "__main__": - sample_ply_data = o3d.data.SamplePointCloudPLY() + sample_ply_data = o3d.data.PLYPointCloud() pcd = o3d.io.read_point_cloud(sample_ply_data.path) # Flip it, otherwise the pointcloud will be upside down. pcd.transform([[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]]) diff --git a/examples/python/geometry/point_cloud_distance.py b/examples/python/geometry/point_cloud_distance.py index 9033061ce84..cc1fd056cee 100644 --- a/examples/python/geometry/point_cloud_distance.py +++ b/examples/python/geometry/point_cloud_distance.py @@ -29,7 +29,7 @@ if __name__ == "__main__": sample_ply_data = o3d.data.DemoCropPointCloud() - pcd = o3d.io.read_point_cloud(sample_ply_data.pointcloud_path) + pcd = o3d.io.read_point_cloud(sample_ply_data.point_cloud_path) vol = o3d.visualization.read_selection_polygon_volume( sample_ply_data.cropped_json_path) chair = vol.crop_point_cloud(pcd) diff --git a/examples/python/geometry/point_cloud_outlier_removal_radius.py b/examples/python/geometry/point_cloud_outlier_removal_radius.py index 15ff3621ee3..c0ed9ff154f 100644 --- a/examples/python/geometry/point_cloud_outlier_removal_radius.py +++ b/examples/python/geometry/point_cloud_outlier_removal_radius.py @@ -39,7 +39,7 @@ def display_inlier_outlier(cloud, ind): if __name__ == "__main__": - ptcloud_data = o3d.data.SamplePointCloudPLY() + ptcloud_data = o3d.data.PLYPointCloud() print("Load a ply point cloud, print it, and render it") pcd = o3d.io.read_point_cloud(ptcloud_data.path) diff --git a/examples/python/geometry/point_cloud_outlier_removal_statistical.py b/examples/python/geometry/point_cloud_outlier_removal_statistical.py index 2a791f0e25a..4aa930df79c 100644 --- a/examples/python/geometry/point_cloud_outlier_removal_statistical.py +++ b/examples/python/geometry/point_cloud_outlier_removal_statistical.py @@ -39,7 +39,7 @@ def display_inlier_outlier(cloud, ind): if __name__ == "__main__": - ptcloud_data = o3d.data.SamplePointCloudPLY() + ptcloud_data = o3d.data.PLYPointCloud() print("Load a ply point cloud, print it, and render it") pcd = o3d.io.read_point_cloud(ptcloud_data.path) diff --git a/examples/python/geometry/point_cloud_paint.py b/examples/python/geometry/point_cloud_paint.py index 087084a39aa..ca5229017db 100644 --- a/examples/python/geometry/point_cloud_paint.py +++ b/examples/python/geometry/point_cloud_paint.py @@ -28,7 +28,7 @@ if __name__ == "__main__": print("Load a ply point cloud, print it, and render it") - sample_ply_data = o3d.data.SamplePointCloudPLY() + sample_ply_data = o3d.data.PLYPointCloud() pcd = o3d.io.read_point_cloud(sample_ply_data.path) # Flip it, otherwise the pointcloud will be upside down. pcd.transform([[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]]) diff --git a/examples/python/geometry/point_cloud_plane_segmentation.py b/examples/python/geometry/point_cloud_plane_segmentation.py index e7611228e6d..80cfe162dc2 100644 --- a/examples/python/geometry/point_cloud_plane_segmentation.py +++ b/examples/python/geometry/point_cloud_plane_segmentation.py @@ -28,7 +28,7 @@ if __name__ == "__main__": - sample_pcd_data = o3d.data.SamplePointCloudPCD() + sample_pcd_data = o3d.data.PCDPointCloud() pcd = o3d.io.read_point_cloud(sample_pcd_data.path) # Flip it, otherwise the pointcloud will be upside down. pcd.transform([[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]]) diff --git a/examples/python/geometry/point_cloud_to_depth.py b/examples/python/geometry/point_cloud_to_depth.py index 9c250d552d4..bb539bbbe20 100644 --- a/examples/python/geometry/point_cloud_to_depth.py +++ b/examples/python/geometry/point_cloud_to_depth.py @@ -29,7 +29,7 @@ import matplotlib.pyplot as plt if __name__ == '__main__': - tum_data = o3d.data.SampleRGBDImageTUM() + tum_data = o3d.data.SampleTUMRGBDImage() depth = o3d.t.io.read_image(tum_data.depth_path) intrinsic = o3d.core.Tensor([[535.4, 0, 320.1], [0, 539.2, 247.6], [0, 0, 1]]) diff --git a/examples/python/geometry/point_cloud_to_rgbd.py b/examples/python/geometry/point_cloud_to_rgbd.py index aed025efe3b..f6829f83bf7 100644 --- a/examples/python/geometry/point_cloud_to_rgbd.py +++ b/examples/python/geometry/point_cloud_to_rgbd.py @@ -30,7 +30,7 @@ if __name__ == '__main__': device = o3d.core.Device('CPU:0') - tum_data = o3d.data.SampleRGBDImageTUM() + tum_data = o3d.data.SampleTUMRGBDImage() depth = o3d.t.io.read_image(tum_data.depth_path).to(device) color = o3d.t.io.read_image(tum_data.color_path).to(device) diff --git a/examples/python/geometry/point_cloud_voxel_downsampling.py b/examples/python/geometry/point_cloud_voxel_downsampling.py index 7fdb1277068..089df3a6f3d 100644 --- a/examples/python/geometry/point_cloud_voxel_downsampling.py +++ b/examples/python/geometry/point_cloud_voxel_downsampling.py @@ -28,7 +28,7 @@ if __name__ == "__main__": print("Load a ply point cloud, print it, and render it") - sample_ply_data = o3d.data.SamplePointCloudPLY() + sample_ply_data = o3d.data.PLYPointCloud() pcd = o3d.io.read_point_cloud(sample_ply_data.path) # Flip it, otherwise the pointcloud will be upside down. pcd.transform([[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]]) diff --git a/examples/python/geometry/rgbd_datasets.py b/examples/python/geometry/rgbd_datasets.py index e9f09112810..86a783c4737 100644 --- a/examples/python/geometry/rgbd_datasets.py +++ b/examples/python/geometry/rgbd_datasets.py @@ -69,7 +69,7 @@ def nyu_dataset(): print("Read NYU dataset") # Open3D does not support ppm/pgm file yet. Not using o3d.io.read_image here. # MathplotImage having some ISSUE with NYU pgm file. Not using imread for pgm. - nyu_data = o3d.data.SampleRGBDImageNYU() + nyu_data = o3d.data.SampleNYURGBDImage() color_raw = mpimg.imread(nyu_data.color_path) depth_raw = read_nyu_pgm(nyu_data.depth_path) color = o3d.geometry.Image(color_raw) @@ -82,10 +82,10 @@ def nyu_dataset(): def redwood_dataset(): - print("Read ICL dataset") - icl_data = o3d.data.SampleRGBDDatasetRedwood() - color_raw = o3d.io.read_image(icl_data.color_paths[0]) - depth_raw = o3d.io.read_image(icl_data.depth_paths[0]) + print("Read Redwood dataset") + redwood_data = o3d.data.SampleRedwoodRGBDImages() + color_raw = o3d.io.read_image(redwood_data.color_paths[0]) + depth_raw = o3d.io.read_image(redwood_data.depth_paths[0]) rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth( color_raw, depth_raw, convert_rgb_to_intensity=False) @@ -95,7 +95,7 @@ def redwood_dataset(): def sun_dataset(): print("Read SUN dataset") - sun_data = o3d.data.SampleRGBDImageSUN() + sun_data = o3d.data.SampleSUNRGBDImage() color_raw = o3d.io.read_image(sun_data.color_path) depth_raw = o3d.io.read_image(sun_data.depth_path) rgbd_image = o3d.geometry.RGBDImage.create_from_sun_format( @@ -107,7 +107,7 @@ def sun_dataset(): def tum_dataset(): print("Read TUM dataset") - tum_data = o3d.data.SampleRGBDImageTUM() + tum_data = o3d.data.SampleTUMRGBDImage() color_raw = o3d.io.read_image(tum_data.color_path) depth_raw = o3d.io.read_image(tum_data.depth_path) rgbd_image = o3d.geometry.RGBDImage.create_from_tum_format( diff --git a/examples/python/io/point_cloud_io.py b/examples/python/io/point_cloud_io.py index 79703594dd4..63cb1d26ca9 100644 --- a/examples/python/io/point_cloud_io.py +++ b/examples/python/io/point_cloud_io.py @@ -27,7 +27,7 @@ import open3d as o3d if __name__ == "__main__": - pcd_data = o3d.data.SamplePointCloudPCD() + pcd_data = o3d.data.PCDPointCloud() print( f"Reading pointcloud from file: fragment.pcd stored at {pcd_data.path}") pcd = o3d.io.read_point_cloud(pcd_data.path) diff --git a/examples/python/pipelines/rgbd_integration_uniform.py b/examples/python/pipelines/rgbd_integration_uniform.py index 7b0d00555aa..657d7d0313a 100644 --- a/examples/python/pipelines/rgbd_integration_uniform.py +++ b/examples/python/pipelines/rgbd_integration_uniform.py @@ -35,7 +35,7 @@ from open3d_example import read_trajectory if __name__ == "__main__": - rgbd_data = o3d.data.SampleRGBDDatasetRedwood() + rgbd_data = o3d.data.SampleRedwoodRGBDImages() camera_poses = read_trajectory(rgbd_data.odometry_log_path) camera_intrinsics = o3d.camera.PinholeCameraIntrinsic( o3d.camera.PinholeCameraIntrinsicParameters.PrimeSenseDefault) diff --git a/examples/python/pipelines/rgbd_odometry.py b/examples/python/pipelines/rgbd_odometry.py index 0ca51b4fbe8..7f2427a9c69 100644 --- a/examples/python/pipelines/rgbd_odometry.py +++ b/examples/python/pipelines/rgbd_odometry.py @@ -31,7 +31,7 @@ if __name__ == "__main__": pinhole_camera_intrinsic = o3d.camera.PinholeCameraIntrinsic( o3d.camera.PinholeCameraIntrinsicParameters.PrimeSenseDefault) - rgbd_data = o3d.data.SampleRGBDDatasetRedwood() + rgbd_data = o3d.data.SampleRedwoodRGBDImages() source_color = o3d.io.read_image(rgbd_data.color_paths[0]) source_depth = o3d.io.read_image(rgbd_data.depth_paths[0]) target_color = o3d.io.read_image(rgbd_data.color_paths[1]) diff --git a/examples/python/visualization/customized_visualization.py b/examples/python/visualization/customized_visualization.py index cb41b6be83a..4139cb39cb6 100644 --- a/examples/python/visualization/customized_visualization.py +++ b/examples/python/visualization/customized_visualization.py @@ -162,7 +162,7 @@ def move_forward(vis): if __name__ == "__main__": - pcd_data = o3d.data.SamplePointCloudPCD() + pcd_data = o3d.data.PCDPointCloud() pcd = o3d.io.read_point_cloud(pcd_data.path) print("1. Customized visualization to mimic DrawGeometry") diff --git a/examples/python/visualization/customized_visualization_key_action.py b/examples/python/visualization/customized_visualization_key_action.py index e9c306d3d73..71d98cdec31 100644 --- a/examples/python/visualization/customized_visualization_key_action.py +++ b/examples/python/visualization/customized_visualization_key_action.py @@ -61,7 +61,7 @@ def animation_callback(vis): if __name__ == "__main__": - ply_data = o3d.data.SamplePointCloudPLY() + ply_data = o3d.data.PLYPointCloud() pcd = o3d.io.read_point_cloud(ply_data.path) print( diff --git a/examples/python/visualization/headless_rendering.py b/examples/python/visualization/headless_rendering.py index cb7b464ccd4..3cc062d4002 100644 --- a/examples/python/visualization/headless_rendering.py +++ b/examples/python/visualization/headless_rendering.py @@ -92,7 +92,7 @@ def move_forward(vis): "Please rebuild Open3D with ENABLE_HEADLESS_RENDERING=ON") exit(1) - sample_ply_data = o3d.data.SamplePointCloudPLY() + sample_ply_data = o3d.data.PLYPointCloud() pcd = o3d.io.read_point_cloud(sample_ply_data.path) print("Customized visualization playing a camera trajectory. " diff --git a/examples/python/visualization/load_save_viewpoint.py b/examples/python/visualization/load_save_viewpoint.py index ed45a4324f6..766617dc93e 100644 --- a/examples/python/visualization/load_save_viewpoint.py +++ b/examples/python/visualization/load_save_viewpoint.py @@ -49,7 +49,7 @@ def load_view_point(pcd, filename): if __name__ == "__main__": - pcd_data = o3d.data.SamplePointCloudPCD() + pcd_data = o3d.data.PCDPointCloud() pcd = o3d.io.read_point_cloud(pcd_data.path) save_view_point(pcd, "viewpoint.json") load_view_point(pcd, "viewpoint.json") diff --git a/examples/python/visualization/remove_geometry.py b/examples/python/visualization/remove_geometry.py index 1b242c89d8a..d29d32dca45 100644 --- a/examples/python/visualization/remove_geometry.py +++ b/examples/python/visualization/remove_geometry.py @@ -37,7 +37,7 @@ def visualize_non_blocking(vis, pcds): vis.update_renderer() -pcd_data = o3d.data.SamplePointCloudPCD() +pcd_data = o3d.data.PCDPointCloud() pcd_orig = o3d.io.read_point_cloud(pcd_data.path) flip_transform = [[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]] pcd_orig.transform(flip_transform) diff --git a/examples/python/visualization/video.py b/examples/python/visualization/video.py index e3c7119400a..418fa9c8eb0 100644 --- a/examples/python/visualization/video.py +++ b/examples/python/visualization/video.py @@ -47,7 +47,7 @@ class VideoWindow: def __init__(self): self.rgb_images = [] - rgbd_data = o3d.data.SampleRGBDDatasetRedwood() + rgbd_data = o3d.data.SampleRedwoodRGBDImages() for path in rgbd_data.color_paths: img = o3d.io.read_image(path) self.rgb_images.append(img) diff --git a/python/test/data/test_data.py b/python/test/data/test_data.py index 083403f2402..d9621992a47 100644 --- a/python/test/data/test_data.py +++ b/python/test/data/test_data.py @@ -39,22 +39,21 @@ def test_dataset_base(): ds_custom = o3d.data.Dataset("some_prefix", "/my/custom/data_root") assert Path(ds_custom.data_root) == Path("/my/custom/data_root") assert ds_custom.prefix == "some_prefix" - assert Path(ds_custom.download_dir) == Path( - "/my/custom/data_root/download/some_prefix") - assert Path(ds_custom.extract_dir) == Path( - "/my/custom/data_root/extract/some_prefix") + assert ds_custom.download_dir == "/my/custom/data_root/download/some_prefix" + assert ds_custom.extract_dir == "/my/custom/data_root/extract/some_prefix" -def get_default_gt_dirs(prefix): - gt_data_root = Path.home() / "open3d_data" +def get_test_data_dirs(prefix): + gt_data_root = Path.home() / "open3d_data" / "open3d_test" gt_download_dir = gt_data_root / "download" / prefix gt_extract_dir = gt_data_root / "extract" / prefix return gt_data_root, gt_download_dir, gt_extract_dir def test_simple_dataset_base(): - prefix = "O3DTestSimpleDataset" - gt_data_root, gt_download_dir, gt_extract_dir = get_default_gt_dirs(prefix) + gt_prefix = "BunnyMesh" + gt_data_root, gt_download_dir, gt_extract_dir = get_test_data_dirs( + gt_prefix) url_mirrors = [ "https://github.com/isl-org/open3d_downloads/releases/download/" @@ -65,15 +64,13 @@ def test_simple_dataset_base(): shutil.rmtree(gt_download_dir, ignore_errors=True) shutil.rmtree(gt_extract_dir, ignore_errors=True) - single_download_dataset = o3d.data.SingleDownloadDataset(prefix, - url_mirrors, - md5, - no_extract=True) + single_download_dataset = o3d.data.SingleDownloadDataset( + gt_prefix, url_mirrors, md5, True, str(gt_data_root)) assert Path(gt_extract_dir / "BunnyMesh.ply").exists() assert Path(gt_download_dir / "BunnyMesh.ply").exists() - assert single_download_dataset.prefix == prefix + assert single_download_dataset.prefix == gt_prefix assert Path(single_download_dataset.data_root) == gt_data_root assert Path(single_download_dataset.download_dir) == gt_download_dir assert Path(single_download_dataset.extract_dir) == gt_extract_dir @@ -83,13 +80,14 @@ def test_simple_dataset_base(): def test_demo_icp_pointclouds(): - prefix = "O3DTestDemoICPPointClouds" - gt_data_root, gt_download_dir, gt_extract_dir = get_default_gt_dirs(prefix) + gt_prefix = "DemoICPPointClouds" + gt_data_root, gt_download_dir, gt_extract_dir = get_test_data_dirs( + gt_prefix) shutil.rmtree(gt_download_dir, ignore_errors=True) shutil.rmtree(gt_extract_dir, ignore_errors=True) - demo_icp = o3d.data.DemoICPPointClouds(prefix) + demo_icp = o3d.data.DemoICPPointClouds(str(gt_data_root)) assert Path(gt_download_dir).exists() gt_paths = [ @@ -102,23 +100,24 @@ def test_demo_icp_pointclouds(): assert Path(gt_path) == Path(demo_icp_path) assert Path(gt_path).exists() - assert demo_icp.prefix == prefix - assert Path(demo_icp.data_root) == Path(gt_data_root) - assert Path(demo_icp.download_dir) == Path(gt_download_dir) - assert Path(demo_icp.extract_dir) == Path(gt_extract_dir) + assert demo_icp.prefix == gt_prefix + assert Path(demo_icp.data_root) == gt_data_root + assert Path(demo_icp.download_dir) == gt_download_dir + assert Path(demo_icp.extract_dir) == gt_extract_dir shutil.rmtree(gt_download_dir, ignore_errors=False) shutil.rmtree(gt_extract_dir, ignore_errors=False) def test_demo_colored_icp_pointclouds(): - prefix = "O3DTestDemoColoredICPPointClouds" - gt_data_root, gt_download_dir, gt_extract_dir = get_default_gt_dirs(prefix) + gt_prefix = "DemoColoredICPPointClouds" + gt_data_root, gt_download_dir, gt_extract_dir = get_test_data_dirs( + gt_prefix) shutil.rmtree(gt_download_dir, ignore_errors=True) shutil.rmtree(gt_extract_dir, ignore_errors=True) - demo_colored_icp = o3d.data.DemoColoredICPPointClouds(prefix) + demo_colored_icp = o3d.data.DemoColoredICPPointClouds(str(gt_data_root)) assert Path(gt_download_dir).exists() gt_paths = [ @@ -130,7 +129,7 @@ def test_demo_colored_icp_pointclouds(): assert Path(gt_path) == Path(demo_colored_icp_path) assert Path(gt_path).exists() - assert demo_colored_icp.prefix == prefix + assert demo_colored_icp.prefix == gt_prefix assert Path(demo_colored_icp.data_root) == gt_data_root assert Path(demo_colored_icp.download_dir) == gt_download_dir assert Path(demo_colored_icp.extract_dir) == gt_extract_dir @@ -140,23 +139,24 @@ def test_demo_colored_icp_pointclouds(): def test_demo_crop_pointcloud(): - prefix = "O3DTestDemoCropPointCloud" - gt_data_root, gt_download_dir, gt_extract_dir = get_default_gt_dirs(prefix) + gt_prefix = "DemoCropPointCloud" + gt_data_root, gt_download_dir, gt_extract_dir = get_test_data_dirs( + gt_prefix) shutil.rmtree(gt_download_dir, ignore_errors=True) shutil.rmtree(gt_extract_dir, ignore_errors=True) - demo_crop_pcd = o3d.data.DemoCropPointCloud(prefix) + demo_crop_pcd = o3d.data.DemoCropPointCloud(str(gt_data_root)) assert Path(gt_download_dir).exists() - assert Path(demo_crop_pcd.pointcloud_path) == gt_extract_dir / \ + assert Path(demo_crop_pcd.point_cloud_path) == gt_extract_dir / \ "fragment.ply" - assert Path(demo_crop_pcd.pointcloud_path).exists() + assert Path(demo_crop_pcd.point_cloud_path).exists() assert Path(demo_crop_pcd.cropped_json_path) == gt_extract_dir / \ "cropped.json" - assert Path(demo_crop_pcd.pointcloud_path).exists() + assert Path(demo_crop_pcd.point_cloud_path).exists() - assert demo_crop_pcd.prefix == prefix + assert demo_crop_pcd.prefix == gt_prefix assert Path(demo_crop_pcd.data_root) == gt_data_root assert Path(demo_crop_pcd.download_dir) == gt_download_dir assert Path(demo_crop_pcd.extract_dir) == gt_extract_dir @@ -165,24 +165,26 @@ def test_demo_crop_pointcloud(): shutil.rmtree(gt_extract_dir, ignore_errors=False) -def test_demo_pointcloud_feature_matching(): - prefix = "O3DTestDemoPointCloudFeatureMatching" - gt_data_root, gt_download_dir, gt_extract_dir = get_default_gt_dirs(prefix) +def test_demo_feature_matching_point_clouds(): + gt_prefix = "DemoFeatureMatchingPointClouds" + gt_data_root, gt_download_dir, gt_extract_dir = get_test_data_dirs( + gt_prefix) shutil.rmtree(gt_download_dir, ignore_errors=True) shutil.rmtree(gt_extract_dir, ignore_errors=True) - demo_feature_matching = o3d.data.DemoPointCloudFeatureMatching(prefix) + demo_feature_matching = o3d.data.DemoFeatureMatchingPointClouds( + str(gt_data_root)) assert Path(gt_download_dir).exists() - gt_pointcloud_paths = [ + gt_point_cloud_paths = [ gt_extract_dir / "cloud_bin_0.pcd", gt_extract_dir / "cloud_bin_1.pcd" ] assert len( - demo_feature_matching.pointcloud_paths) == len(gt_pointcloud_paths) - for gt_path, demo_feature_matching_pointcloud_path in zip( - gt_pointcloud_paths, demo_feature_matching.pointcloud_paths): - assert Path(demo_feature_matching_pointcloud_path) == gt_path + demo_feature_matching.point_cloud_paths) == len(gt_point_cloud_paths) + for gt_path, demo_feature_matching_point_cloud_path in zip( + gt_point_cloud_paths, demo_feature_matching.point_cloud_paths): + assert Path(demo_feature_matching_point_cloud_path) == gt_path assert Path(gt_path).exists() gt_fpfh_feature_paths = [ @@ -207,7 +209,7 @@ def test_demo_pointcloud_feature_matching(): assert Path(demo_feature_matching_l32d_feature_path) == gt_path assert Path(gt_path).exists() - assert demo_feature_matching.prefix == prefix + assert demo_feature_matching.prefix == gt_prefix assert Path(demo_feature_matching.data_root) == gt_data_root assert Path(demo_feature_matching.download_dir) == gt_download_dir assert Path(demo_feature_matching.extract_dir) == gt_extract_dir @@ -217,13 +219,15 @@ def test_demo_pointcloud_feature_matching(): def test_demo_pose_graph_optimization(): - prefix = "O3DTestDemoPoseGraphOptimization" - gt_data_root, gt_download_dir, gt_extract_dir = get_default_gt_dirs(prefix) + gt_prefix = "DemoPoseGraphOptimization" + gt_data_root, gt_download_dir, gt_extract_dir = get_test_data_dirs( + gt_prefix) shutil.rmtree(gt_download_dir, ignore_errors=True) shutil.rmtree(gt_extract_dir, ignore_errors=True) - demo_pose_optimization = o3d.data.DemoPoseGraphOptimization(prefix) + demo_pose_optimization = o3d.data.DemoPoseGraphOptimization( + str(gt_data_root)) assert Path(gt_download_dir).exists() assert Path(demo_pose_optimization.pose_graph_fragment_path) == gt_extract_dir / \ @@ -233,7 +237,7 @@ def test_demo_pose_graph_optimization(): "pose_graph_example_global.json" assert Path(demo_pose_optimization.pose_graph_global_path).exists() - assert demo_pose_optimization.prefix == prefix + assert demo_pose_optimization.prefix == gt_prefix assert Path(demo_pose_optimization.data_root) == gt_data_root assert Path(demo_pose_optimization.download_dir) == gt_download_dir assert Path(demo_pose_optimization.extract_dir) == gt_extract_dir @@ -242,20 +246,21 @@ def test_demo_pose_graph_optimization(): shutil.rmtree(gt_extract_dir, ignore_errors=False) -def test_sample_pointcloud_pcd(): - prefix = "O3DTestSamplePointCloudPCD" - gt_data_root, gt_download_dir, gt_extract_dir = get_default_gt_dirs(prefix) +def test_pcd_point_cloud(): + gt_prefix = "PCDPointCloud" + gt_data_root, gt_download_dir, gt_extract_dir = get_test_data_dirs( + gt_prefix) shutil.rmtree(gt_download_dir, ignore_errors=True) shutil.rmtree(gt_extract_dir, ignore_errors=True) - pcd_pointcloud = o3d.data.SamplePointCloudPCD(prefix) + pcd_pointcloud = o3d.data.PCDPointCloud(str(gt_data_root)) assert Path(gt_download_dir).exists() assert Path(pcd_pointcloud.path) == gt_extract_dir / "fragment.pcd" assert Path(pcd_pointcloud.path).exists() - assert pcd_pointcloud.prefix == prefix + assert pcd_pointcloud.prefix == gt_prefix assert Path(pcd_pointcloud.data_root) == gt_data_root assert Path(pcd_pointcloud.download_dir) == gt_download_dir assert Path(pcd_pointcloud.extract_dir) == gt_extract_dir @@ -264,20 +269,21 @@ def test_sample_pointcloud_pcd(): shutil.rmtree(gt_extract_dir, ignore_errors=False) -def test_sample_pointcloud_ply(): - prefix = "O3DTestSamplePointCloudPLY" - gt_data_root, gt_download_dir, gt_extract_dir = get_default_gt_dirs(prefix) +def test_ply_point_cloud(): + gt_prefix = "PLYPointCloud" + gt_data_root, gt_download_dir, gt_extract_dir = get_test_data_dirs( + gt_prefix) shutil.rmtree(gt_download_dir, ignore_errors=True) shutil.rmtree(gt_extract_dir, ignore_errors=True) - ply_pointcloud = o3d.data.SamplePointCloudPLY(prefix) + ply_pointcloud = o3d.data.PLYPointCloud(str(gt_data_root)) assert Path(gt_download_dir).exists() assert Path(ply_pointcloud.path) == gt_extract_dir / "fragment.ply" assert Path(ply_pointcloud.path).exists() - assert ply_pointcloud.prefix == prefix + assert ply_pointcloud.prefix == gt_prefix assert Path(ply_pointcloud.data_root) == gt_data_root assert Path(ply_pointcloud.download_dir) == gt_download_dir assert Path(ply_pointcloud.extract_dir) == gt_extract_dir @@ -286,14 +292,15 @@ def test_sample_pointcloud_ply(): shutil.rmtree(gt_extract_dir, ignore_errors=False) -def test_sample_rgbd_image_nyu(): - prefix = "O3DTestSampleRGBDImageNYU" - gt_data_root, gt_download_dir, gt_extract_dir = get_default_gt_dirs(prefix) +def test_sample_nyu_rgbd_image(): + gt_prefix = "SampleNYURGBDImage" + gt_data_root, gt_download_dir, gt_extract_dir = get_test_data_dirs( + gt_prefix) shutil.rmtree(gt_download_dir, ignore_errors=True) shutil.rmtree(gt_extract_dir, ignore_errors=True) - rgbd_image_nyu = o3d.data.SampleRGBDImageNYU(prefix) + rgbd_image_nyu = o3d.data.SampleNYURGBDImage(str(gt_data_root)) assert Path(gt_download_dir).exists() assert Path(rgbd_image_nyu.color_path) == gt_extract_dir / "NYU_color.ppm" @@ -302,7 +309,7 @@ def test_sample_rgbd_image_nyu(): assert Path(rgbd_image_nyu.depth_path) == gt_extract_dir / "NYU_depth.pgm" assert Path(rgbd_image_nyu.depth_path).exists() - assert rgbd_image_nyu.prefix == prefix + assert rgbd_image_nyu.prefix == gt_prefix assert Path(rgbd_image_nyu.data_root) == gt_data_root assert Path(rgbd_image_nyu.download_dir) == gt_download_dir assert Path(rgbd_image_nyu.extract_dir) == gt_extract_dir @@ -311,14 +318,15 @@ def test_sample_rgbd_image_nyu(): shutil.rmtree(gt_extract_dir, ignore_errors=False) -def test_sample_rgbd_image_sun(): - prefix = "O3DTestSampleRGBDImageSUN" - gt_data_root, gt_download_dir, gt_extract_dir = get_default_gt_dirs(prefix) +def test_sample_sun_rgbd_image(): + gt_prefix = "SampleSUNRGBDImage" + gt_data_root, gt_download_dir, gt_extract_dir = get_test_data_dirs( + gt_prefix) shutil.rmtree(gt_download_dir, ignore_errors=True) shutil.rmtree(gt_extract_dir, ignore_errors=True) - rgbd_image_sun = o3d.data.SampleRGBDImageSUN(prefix) + rgbd_image_sun = o3d.data.SampleSUNRGBDImage(str(gt_data_root)) assert Path(gt_download_dir).exists() assert Path(rgbd_image_sun.color_path) == gt_extract_dir / "SUN_color.jpg" @@ -327,7 +335,7 @@ def test_sample_rgbd_image_sun(): assert Path(rgbd_image_sun.depth_path) == gt_extract_dir / "SUN_depth.png" assert Path(rgbd_image_sun.depth_path).exists() - assert rgbd_image_sun.prefix == prefix + assert rgbd_image_sun.prefix == gt_prefix assert Path(rgbd_image_sun.data_root) == gt_data_root assert Path(rgbd_image_sun.download_dir) == gt_download_dir assert Path(rgbd_image_sun.extract_dir) == gt_extract_dir @@ -336,14 +344,15 @@ def test_sample_rgbd_image_sun(): shutil.rmtree(gt_extract_dir, ignore_errors=False) -def test_sample_rgbd_image_tum(): - prefix = "O3DTestSampleRGBDImageTUM" - gt_data_root, gt_download_dir, gt_extract_dir = get_default_gt_dirs(prefix) +def test_sample_tum_rgbd_image(): + gt_prefix = "SampleTUMRGBDImage" + gt_data_root, gt_download_dir, gt_extract_dir = get_test_data_dirs( + gt_prefix) shutil.rmtree(gt_download_dir, ignore_errors=True) shutil.rmtree(gt_extract_dir, ignore_errors=True) - rgbd_image_tum = o3d.data.SampleRGBDImageTUM(prefix) + rgbd_image_tum = o3d.data.SampleTUMRGBDImage(str(gt_data_root)) assert Path(gt_download_dir).exists() assert Path(rgbd_image_tum.color_path) == gt_extract_dir / "TUM_color.png" @@ -352,7 +361,7 @@ def test_sample_rgbd_image_tum(): assert Path(rgbd_image_tum.depth_path) == gt_extract_dir / "TUM_depth.png" assert Path(rgbd_image_tum.depth_path).exists() - assert rgbd_image_tum.prefix == prefix + assert rgbd_image_tum.prefix == gt_prefix assert Path(rgbd_image_tum.data_root) == gt_data_root assert Path(rgbd_image_tum.download_dir) == gt_download_dir assert Path(rgbd_image_tum.extract_dir) == gt_extract_dir @@ -361,14 +370,15 @@ def test_sample_rgbd_image_tum(): shutil.rmtree(gt_extract_dir, ignore_errors=False) -def test_sample_rgbd_dataset_redwood(): - prefix = "O3DTestSampleRGBDDatasetRedwood" - gt_data_root, gt_download_dir, gt_extract_dir = get_default_gt_dirs(prefix) +def test_sample_redwood_rgbd_images(): + gt_prefix = "SampleRedwoodRGBDImages" + gt_data_root, gt_download_dir, gt_extract_dir = get_test_data_dirs( + gt_prefix) shutil.rmtree(gt_download_dir, ignore_errors=True) shutil.rmtree(gt_extract_dir, ignore_errors=True) - rgbd_dataset_redwood = o3d.data.SampleRGBDDatasetRedwood(prefix) + rgbd_dataset_redwood = o3d.data.SampleRedwoodRGBDImages(str(gt_data_root)) assert Path(gt_download_dir).exists() gt_color_paths = [ @@ -406,7 +416,7 @@ def test_sample_rgbd_dataset_redwood(): assert Path(rgbd_dataset_redwood.reconstruction_path ) == gt_extract_dir / "example_tsdf_pcd.ply" - assert rgbd_dataset_redwood.prefix == prefix + assert rgbd_dataset_redwood.prefix == gt_prefix assert Path(rgbd_dataset_redwood.data_root) == gt_data_root assert Path(rgbd_dataset_redwood.download_dir) == gt_download_dir assert Path(rgbd_dataset_redwood.extract_dir) == gt_extract_dir @@ -415,14 +425,15 @@ def test_sample_rgbd_dataset_redwood(): shutil.rmtree(gt_extract_dir, ignore_errors=False) -def test_sample_fountain_rgbd_dataset(): - prefix = "O3DTestSampleFountainRGBDDataset" - gt_data_root, gt_download_dir, gt_extract_dir = get_default_gt_dirs(prefix) +def test_sample_fountain_rgbd_images(): + gt_prefix = "SampleFountainRGBDImages" + gt_data_root, gt_download_dir, gt_extract_dir = get_test_data_dirs( + gt_prefix) shutil.rmtree(gt_download_dir, ignore_errors=True) shutil.rmtree(gt_extract_dir, ignore_errors=True) - fountain_dataset = o3d.data.SampleFountainRGBDDataset(prefix) + fountain_dataset = o3d.data.SampleFountainRGBDImages(str(gt_data_root)) assert Path(gt_download_dir).exists() gt_color_paths = [ @@ -512,7 +523,7 @@ def test_sample_fountain_rgbd_dataset(): assert Path(fountain_dataset.reconstruction_path ) == gt_extract_dir / "scene" / "integrated.ply" - assert fountain_dataset.prefix == prefix + assert fountain_dataset.prefix == gt_prefix assert Path(fountain_dataset.data_root) == gt_data_root assert Path(fountain_dataset.download_dir) == gt_download_dir assert Path(fountain_dataset.extract_dir) == gt_extract_dir @@ -522,19 +533,20 @@ def test_sample_fountain_rgbd_dataset(): def test_eagle(): - prefix = "O3DTestEagle" - gt_data_root, gt_download_dir, gt_extract_dir = get_default_gt_dirs(prefix) + gt_prefix = "EaglePointCloud" + gt_data_root, gt_download_dir, gt_extract_dir = get_test_data_dirs( + gt_prefix) shutil.rmtree(gt_download_dir, ignore_errors=True) shutil.rmtree(gt_extract_dir, ignore_errors=True) - eagle = o3d.data.EaglePointCloud(prefix) + eagle = o3d.data.EaglePointCloud(str(gt_data_root)) assert Path(gt_download_dir).exists() assert Path(eagle.path) == gt_extract_dir / "EaglePointCloud.ply" assert Path(eagle.path).exists() - assert eagle.prefix == prefix + assert eagle.prefix == gt_prefix assert Path(eagle.data_root) == gt_data_root assert Path(eagle.download_dir) == gt_download_dir assert Path(eagle.extract_dir) == gt_extract_dir @@ -544,19 +556,20 @@ def test_eagle(): def test_armadillo(): - prefix = "O3DTestArmadillo" - gt_data_root, gt_download_dir, gt_extract_dir = get_default_gt_dirs(prefix) + gt_prefix = "ArmadilloMesh" + gt_data_root, gt_download_dir, gt_extract_dir = get_test_data_dirs( + gt_prefix) shutil.rmtree(gt_download_dir, ignore_errors=True) shutil.rmtree(gt_extract_dir, ignore_errors=True) - armadillo = o3d.data.ArmadilloMesh(prefix) + armadillo = o3d.data.ArmadilloMesh(str(gt_data_root)) assert Path(gt_download_dir).exists() assert Path(armadillo.path) == gt_extract_dir / "ArmadilloMesh.ply" assert Path(armadillo.path).exists() - assert armadillo.prefix == prefix + assert armadillo.prefix == gt_prefix assert Path(armadillo.data_root) == gt_data_root assert Path(armadillo.download_dir) == gt_download_dir assert Path(armadillo.extract_dir) == gt_extract_dir @@ -566,19 +579,20 @@ def test_armadillo(): def test_bunny(): - prefix = "O3DTestBunny" - gt_data_root, gt_download_dir, gt_extract_dir = get_default_gt_dirs(prefix) + gt_prefix = "BunnyMesh" + gt_data_root, gt_download_dir, gt_extract_dir = get_test_data_dirs( + gt_prefix) shutil.rmtree(gt_download_dir, ignore_errors=True) shutil.rmtree(gt_extract_dir, ignore_errors=True) - bunny = o3d.data.BunnyMesh(prefix) + bunny = o3d.data.BunnyMesh(str(gt_data_root)) assert Path(gt_download_dir).exists() assert Path(bunny.path) == gt_extract_dir / "BunnyMesh.ply" assert Path(bunny.path).exists() - assert bunny.prefix == prefix + assert bunny.prefix == gt_prefix assert Path(bunny.data_root) == gt_data_root assert Path(bunny.download_dir) == gt_download_dir assert Path(bunny.extract_dir) == gt_extract_dir @@ -588,19 +602,20 @@ def test_bunny(): def test_knot(): - prefix = "O3DTestKnot" - gt_data_root, gt_download_dir, gt_extract_dir = get_default_gt_dirs(prefix) + gt_prefix = "KnotMesh" + gt_data_root, gt_download_dir, gt_extract_dir = get_test_data_dirs( + gt_prefix) shutil.rmtree(gt_download_dir, ignore_errors=True) shutil.rmtree(gt_extract_dir, ignore_errors=True) - knot = o3d.data.KnotMesh(prefix) + knot = o3d.data.KnotMesh(str(gt_data_root)) assert Path(gt_download_dir).exists() assert Path(knot.path) == gt_extract_dir / "KnotMesh.ply" assert Path(knot.path).exists() - assert knot.prefix == prefix + assert knot.prefix == gt_prefix assert Path(knot.data_root) == gt_data_root assert Path(knot.download_dir) == gt_download_dir assert Path(knot.extract_dir) == gt_extract_dir @@ -610,19 +625,20 @@ def test_knot(): def test_juneau(): - prefix = "O3DTestJuneau" - gt_data_root, gt_download_dir, gt_extract_dir = get_default_gt_dirs(prefix) + gt_prefix = "JuneauImage" + gt_data_root, gt_download_dir, gt_extract_dir = get_test_data_dirs( + gt_prefix) shutil.rmtree(gt_download_dir, ignore_errors=True) shutil.rmtree(gt_extract_dir, ignore_errors=True) - juneau = o3d.data.JuneauImage(prefix) + juneau = o3d.data.JuneauImage(str(gt_data_root)) assert Path(gt_download_dir).exists() assert Path(juneau.path) == gt_extract_dir / "JuneauImage.jpg" assert Path(juneau.path).exists() - assert juneau.prefix == prefix + assert juneau.prefix == gt_prefix assert Path(juneau.data_root) == gt_data_root assert Path(juneau.download_dir) == gt_download_dir assert Path(juneau.extract_dir) == gt_extract_dir diff --git a/python/test/open3d_test.py b/python/test/open3d_test.py index c0361bc098a..14076114879 100644 --- a/python/test/open3d_test.py +++ b/python/test/open3d_test.py @@ -91,17 +91,3 @@ def list_devices_with_torch(): return [o3d.core.Device("CPU:0")] else: return [] - - -def download_fountain_dataset(): - fountain_path = os.path.join(test_data_dir, "fountain_small") - fountain_zip_path = os.path.join(test_data_dir, "fountain.zip") - if not os.path.exists(fountain_path): - print("Downloading fountain dataset") - url = "https://github.com/isl-org/open3d_downloads/releases/download/open3d_tutorial/fountain.zip" - urllib.request.urlretrieve(url, fountain_zip_path) - print("Extracting fountain dataset") - with zipfile.ZipFile(fountain_zip_path, "r") as zip_ref: - zip_ref.extractall(os.path.dirname(fountain_path)) - os.remove(fountain_zip_path) - return fountain_path diff --git a/python/test/test_color_map_optimization.py b/python/test/test_color_map_optimization.py index 912408a84d2..934297593af 100644 --- a/python/test/test_color_map_optimization.py +++ b/python/test/test_color_map_optimization.py @@ -28,12 +28,11 @@ import numpy as np import re import os -from open3d_test import download_fountain_dataset def load_fountain_dataset(): rgbd_images = [] - fountain_rgbd_dataset = o3d.data.SampleFountainRGBDDataset() + fountain_rgbd_dataset = o3d.data.SampleFountainRGBDImages() for i in range(len(fountain_rgbd_dataset.depth_paths)): depth = o3d.io.read_image(fountain_rgbd_dataset.depth_paths[i]) color = o3d.io.read_image(fountain_rgbd_dataset.color_paths[i]) diff --git a/python/test/test_octree.py b/python/test/test_octree.py index 2daa84aa304..830257f6fd0 100644 --- a/python/test/test_octree.py +++ b/python/test/test_octree.py @@ -27,7 +27,6 @@ import open3d as o3d import numpy as np import os -from open3d_test import test_data_dir _eight_cubes_colors = np.array([ [0.0, 0.0, 0.0], @@ -119,8 +118,8 @@ def test_octree_node_access(): def test_octree_visualize(): - pcd_path = os.path.join(test_data_dir, "fragment.ply") - pcd = o3d.io.read_point_cloud(pcd_path) + pcd_data = o3d.data.PLYPointCloud() + pcd = o3d.io.read_point_cloud(pcd_data.path) octree = o3d.geometry.Octree(8) octree.convert_from_point_cloud(pcd) # Enable the following line to test visualization @@ -128,8 +127,8 @@ def test_octree_visualize(): def test_octree_voxel_grid_convert(): - pcd_path = os.path.join(test_data_dir, "fragment.ply") - pcd = o3d.io.read_point_cloud(pcd_path) + pcd_data = o3d.data.PLYPointCloud() + pcd = o3d.io.read_point_cloud(pcd_data.path) octree = o3d.geometry.Octree(8) octree.convert_from_point_cloud(pcd) @@ -143,8 +142,8 @@ def test_octree_voxel_grid_convert(): def test_locate_leaf_node(): - pcd_path = os.path.join(test_data_dir, "fragment.ply") - pcd = o3d.io.read_point_cloud(pcd_path) + pcd_data = o3d.data.PLYPointCloud() + pcd = o3d.io.read_point_cloud(pcd_data.path) max_depth = 5 octree = o3d.geometry.Octree(max_depth)