MCPcopy Create free account
hub / github.com/colmap/colmap / Bitmap

Class Bitmap

src/colmap/sensor/bitmap.h:68–195  ·  view source on GitHub ↗

Wrapper class around bitmaps.

Source from the content-addressed store, hash-verified

66
67// Wrapper class around bitmaps.
68class Bitmap {
69 public:
70 Bitmap();
71
72 // Construct bitmap with given dimensions.
73 Bitmap(int width, int height, bool as_rgb, bool linear_colorspace = false);
74
75 Bitmap(const Bitmap& other);
76 Bitmap(Bitmap&& other) noexcept;
77
78 Bitmap& operator=(const Bitmap& other);
79 Bitmap& operator=(Bitmap&& other) noexcept;
80
81 // Dimensions of bitmap.
82 inline int Width() const;
83 inline int Height() const;
84 inline int Channels() const;
85
86 // Number of bits per pixel. This is 8 for grey and 24 for RGB images.
87 inline int BitsPerPixel() const;
88
89 // Number of bytes required to store image.
90 inline size_t NumBytes() const;
91
92 // Scan line size in bytes, also known as stride.
93 inline int Pitch() const;
94
95 // Check whether the image is empty (i.e., width/height=0).
96 inline bool IsEmpty() const;
97
98 // Check whether image is grey- or colorscale.
99 inline bool IsRGB() const;
100 inline bool IsGrey() const;
101
102 // Access raw image data array.
103 inline std::vector<uint8_t>& RowMajorData();
104 inline const std::vector<uint8_t>& RowMajorData() const;
105
106 // Manipulate individual pixels. For grayscale images, only the red element
107 // of the RGB color is used.
108 inline std::optional<BitmapColor<uint8_t>> GetPixel(int x, int y) const;
109 inline bool SetPixel(int x, int y, const BitmapColor<uint8_t>& color);
110
111 // Fill entire bitmap with uniform color. For grayscale images, the first
112 // element of the vector is used.
113 void Fill(const BitmapColor<uint8_t>& color);
114
115 // Interpolate color at given floating point position.
116 std::optional<BitmapColor<uint8_t>> InterpolateNearestNeighbor(
117 double x, double y) const;
118 std::optional<BitmapColor<float>> InterpolateBilinear(double x,
119 double y) const;
120
121 // Extract EXIF information from bitmap. Returns std::nullopt if no EXIF
122 // information is embedded in the bitmap.
123 std::optional<int> ExifOrientation() const;
124 std::optional<std::string> ExifCameraModel() const;
125 std::optional<double> ExifFocalLength() const;

Callers 10

BindBitmapFunction · 0.85
RunMethod · 0.85
RunMethod · 0.85
WarpImageBetweenCamerasFunction · 0.85
MeshTextureMappingFunction · 0.85
TESTFunction · 0.85
TEST_PFunction · 0.85
CreateRandomRgbImageFunction · 0.85

Calls

no outgoing calls

Tested by 3

TESTFunction · 0.68
TEST_PFunction · 0.68
CreateRandomRgbImageFunction · 0.68