ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
depth_map.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <string>
11 #include <vector>
12 
13 #include "mvs/mat.h"
14 #include "util/bitmap.h"
15 
16 namespace colmap {
17 namespace mvs {
18 
19 class DepthMap : public Mat<float> {
20 public:
21  DepthMap();
22  DepthMap(const size_t width,
23  const size_t height,
24  const float depth_min,
25  const float depth_max);
26  DepthMap(const Mat<float>& mat,
27  const float depth_min,
28  const float depth_max);
29 
30  inline float GetDepthMin() const;
31  inline float GetDepthMax() const;
32 
33  inline float Get(const size_t row, const size_t col) const;
34 
35  void Rescale(const float factor);
36  void Downsize(const size_t max_width, const size_t max_height);
37 
38  Bitmap ToBitmap(const float min_percentile,
39  const float max_percentile) const;
40 
41 private:
42  float depth_min_ = -1.0f;
43  float depth_max_ = -1.0f;
44 };
45 
47 // Implementation
49 
50 float DepthMap::GetDepthMin() const { return depth_min_; }
51 
52 float DepthMap::GetDepthMax() const { return depth_max_; }
53 
54 float DepthMap::Get(const size_t row, const size_t col) const {
55  return data_.at(row * width_ + col);
56 }
57 
58 } // namespace mvs
59 } // namespace colmap
int width
int height
void Downsize(const size_t max_width, const size_t max_height)
Definition: depth_map.cc:75
float GetDepthMin() const
Definition: depth_map.h:50
float Get(const size_t row, const size_t col) const
Definition: depth_map.h:54
Bitmap ToBitmap(const float min_percentile, const float max_percentile) const
Definition: depth_map.cc:84
float GetDepthMax() const
Definition: depth_map.h:52
void Rescale(const float factor)
Definition: depth_map.cc:57
std::vector< float > data_
Definition: mat.h:54