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

Function MakeGrazingAngleImage

src/colmap/mvs/texture_mapping_test.cc:126–152  ·  view source on GitHub ↗

Create a camera that views the mesh at a very grazing angle. Camera nearly in-plane with XY mesh, at (0.5, 0.5, 0.01), looking along -Z.

Source from the content-addressed store, hash-verified

124// Create a camera that views the mesh at a very grazing angle.
125// Camera nearly in-plane with XY mesh, at (0.5, 0.5, 0.01), looking along -Z.
126Image MakeGrazingAngleImage(int width, int height) {
127 float K[9] = {0};
128 K[0] = static_cast<float>(width);
129 K[4] = static_cast<float>(height);
130 K[2] = static_cast<float>(width) / 2.0f;
131 K[5] = static_cast<float>(height) / 2.0f;
132 K[8] = 1.0f;
133
134 // R: 180° around X.
135 float R[9] = {1, 0, 0, 0, -1, 0, 0, 0, -1};
136
137 // C = (0.5, 0.5, 0.01), T = -R*C = [-0.5, 0.5, 0.01]
138 float T[3] = {-0.5f, 0.5f, 0.01f};
139
140 Image image("grazing.png",
141 static_cast<size_t>(width),
142 static_cast<size_t>(height),
143 K,
144 R,
145 T);
146
147 Bitmap bitmap(width, height, /*as_rgb=*/true);
148 bitmap.Fill(BitmapColor<uint8_t>(128));
149 image.SetBitmap(std::move(bitmap));
150
151 return image;
152}
153
154// Create a 4-face pyramid mesh.
155PlyMesh MakePyramidMesh() {

Callers 1

TESTFunction · 0.85

Calls 2

SetBitmapMethod · 0.80
FillMethod · 0.45

Tested by

no test coverage detected