10 #include <benchmark/benchmark.h>
31 return core::Tensor::Init<double>(
32 {{(focal_length.first), 0, (principal_point.first)},
33 {0, (focal_length.second), (principal_point.second)},
43 const float depth_scale = 1000.0;
44 const float depth_diff = 0.07;
45 const float depth_max = 3.0;
53 src_depth = src_depth.
To(device);
54 dst_depth = dst_depth.
To(device);
71 for (
int i = 0; i < 20; ++i) {
74 src_normal_map.
AsTensor(), intrinsic_t, trans, depth_diff,
76 trans =
result.transformation_.Matmul(trans).Contiguous();
79 for (
auto _ : state) {
83 for (
int i = 0; i < 20; ++i) {
88 src_normal_map.
AsTensor(), intrinsic_t, trans,
89 depth_diff, depth_diff * 0.5);
90 trans =
result.transformation_.Matmul(trans).Contiguous();
97 benchmark::State& state,
104 const float depth_scale = 1000.0;
105 const float depth_max = 3.0;
106 const float depth_diff = 0.07;
121 source.
color_ = src_color.
To(device);
122 source.
depth_ = src_depth.
To(device);
123 target.
color_ = dst_color.
To(device);
124 target.
depth_ = dst_depth.
To(device);
130 std::vector<t::pipelines::odometry::OdometryConvergenceCriteria> criteria{
140 source, target, intrinsic_t,
142 depth_scale, depth_max, criteria, method, loss);
144 for (
auto _ : state) {
146 source, target, intrinsic_t,
148 depth_scale, depth_max, criteria, method, loss);
154 ->Unit(benchmark::kMillisecond);
155 #ifdef BUILD_CUDA_MODULE
159 ->Unit(benchmark::kMillisecond);
166 ->Unit(benchmark::kMillisecond);
171 ->Unit(benchmark::kMillisecond);
176 ->Unit(benchmark::kMillisecond);
178 #ifdef BUILD_CUDA_MODULE
183 ->Unit(benchmark::kMillisecond);
188 ->Unit(benchmark::kMillisecond);
193 ->Unit(benchmark::kMillisecond);
Contains the pinhole camera intrinsic parameters.
std::pair< double, double > GetFocalLength() const
Returns the focal length in a tuple of X-axis and Y-axis focal lengths.
std::pair< double, double > GetPrincipalPoint() const
bool IsCPU() const
Returns true iff device type is CPU.
static Tensor Eye(int64_t n, Dtype dtype, const Device &device)
Create an identity matrix of size n x n.
Data class for SampleRedwoodRGBDImages contains a sample set of 5 color and depth images from Redwood...
std::vector< std::string > GetDepthPaths() const
Returns List of paths to depth image samples of size 5.
std::vector< std::string > GetColorPaths() const
Returns List of paths to color image samples of size 5.
The Image class stores image with customizable rows, cols, channels, dtype and device.
Image ClipTransform(float scale, float min_value, float max_value, float clip_fill=0.0f) const
Return new image after scaling and clipping image values.
static constexpr bool HAVE_IPP
Do we use IPP for accelerating image processing operations?
Image CreateVertexMap(const core::Tensor &intrinsics, float invalid_fill=0.0f)
Create a vertex map from a depth image using unprojection.
Image To(const core::Device &device, bool copy=false) const
Transfer the image to a specified device.
Image CreateNormalMap(float invalid_fill=0.0f)
Create a normal map from a vertex map.
core::Tensor AsTensor() const
Returns the underlying Tensor of the Image.
RGBDImage A pair of color and depth images.
Image depth_
The depth image.
Image color_
The color image.
@ PrimeSenseDefault
Default settings for PrimeSense camera sensor.
std::shared_ptr< geometry::Image > CreateImageFromFile(const std::string &filename)
OdometryResult RGBDOdometryMultiScale(const RGBDImage &source, const RGBDImage &target, const Tensor &intrinsics, const Tensor &init_source_to_target, const float depth_scale, const float depth_max, const std::vector< OdometryConvergenceCriteria > &criteria, const Method method, const OdometryLossParams ¶ms)
Create an RGBD image pyramid given the original source and target RGBD images, and perform hierarchic...
static core::Tensor CreateIntrisicTensor()
OdometryResult ComputeOdometryResultPointToPlane(const Tensor &source_vertex_map, const Tensor &target_vertex_map, const Tensor &target_normal_map, const Tensor &intrinsics, const Tensor &init_source_to_target, const float depth_outlier_trunc, const float depth_huber_delta)
Estimates the 4x4 rigid transformation T from source to target, with inlier rmse and fitness....
BENCHMARK_CAPTURE(RGBDOdometryMultiScale, Hybrid_CPU, core::Device("CPU:0"), t::pipelines::odometry::Method::Hybrid) -> Unit(benchmark::kMillisecond)
Generic file read and write utility for python interface.