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
warp.h
colmap::mvs::DepthMap::GetDepthMax
float GetDepthMax() const
Definition: depth_map.h:52
x
normal_z x
Definition: my_point_types.h:165
colmap::mvs::Mat< float >::height_
size_t height_
Definition: mat.h:52
bitmap.h
colmap::Bitmap::SetPixel
bool SetPixel(const int x, const int y, const BitmapColor< uint8_t > &color)
Definition: bitmap.cc:199
colmap::Bitmap
Definition: bitmap.h:51
colmap::mvs::DepthMap::Get
float Get(const size_t row, const size_t col) const
Definition: depth_map.h:54
colmap::mvs::Mat::GetDepth
size_t GetDepth() const
Definition: mat.h:81
colmap::Bitmap::Allocate
bool Allocate(const int width, const int height, const bool as_rgb)
Definition: bitmap.cc:104
color
math::float4 color
Definition: LineSetBuffers.cpp:46
mat.h
colmap::mvs::Mat< float >::data_
std::vector< float > data_
Definition: mat.h:54
colmap::mvs::DepthMap::Downsize
void Downsize(const size_t max_width, const size_t max_height)
Definition: depth_map.cc:75
width
int width
Definition: FileIOFactory.cpp:142
float
float
Definition: my_point_types.h:154
colmap::mvs::Mat::GetData
const std::vector< T > & GetData() const
Definition: mat.h:113
colmap::mvs::DepthMap::ToBitmap
Bitmap ToBitmap(const float min_percentile, const float max_percentile) const
Definition: depth_map.cc:84
height
int height
Definition: FileIOFactory.cpp:143
math.h
y
normal_z y
Definition: my_point_types.h:168
depth_map.h
colmap::mvs::DepthMap::GetDepthMin
float GetDepthMin() const
Definition: depth_map.h:50
colmap::DownsampleImage
void DownsampleImage(const float *data, const int rows, const int cols, const int new_rows, const int new_cols, float *downsampled)
Definition: warp.cc:226
colmap::mvs::DepthMap::DepthMap
DepthMap()
Definition: depth_map.cc:40
colmap::mvs::DepthMap::Rescale
void Rescale(const float factor)
Definition: depth_map.cc:57
colmap::JetColormap::Green
static float Green(const float gray)
Definition: bitmap.cc:657
colmap::JetColormap::Red
static float Red(const float gray)
Definition: bitmap.cc:655
colmap::BitmapColor
Definition: bitmap.h:30
colmap::JetColormap::Blue
static float Blue(const float gray)
Definition: bitmap.cc:659
colmap::mvs::DepthMap
Definition: depth_map.h:19
colmap::mvs::Mat
Definition: mat.h:21
colmap
Definition: AutomaticReconstructionController.h:17
colmap::Percentile
T Percentile(const std::vector< T > &elems, const double p)
Definition: math.h:209
colmap::Bitmap::Fill
void Fill(const BitmapColor< uint8_t > &color)
Definition: bitmap.cc:226
colmap::mvs::Mat< float >::width_
size_t width_
Definition: mat.h:51