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

Function TEST

src/colmap/mvs/texture_mapping_test.cc:209–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207}
208
209TEST(MeshTextureMapping, EndToEnd) {
210 const PlyMesh mesh = MakeTriangleMesh();
211 const BitmapColor<uint8_t> red(200, 50, 50);
212 std::vector<Image> images;
213 images.push_back(MakeTestImage(256, 256, red));
214
215 MeshTextureMappingOptions options;
216 options.apply_color_correction = false;
217 options.view_selection_smoothing_iterations = 0;
218 options.inpaint_radius = 0;
219
220 const auto result = MeshTextureMapping(mesh, images, options);
221
222 // Check basic properties.
223 EXPECT_GT(result.atlas_width, 0);
224 EXPECT_GT(result.atlas_height, 0);
225 EXPECT_EQ(result.face_uvs.size(), mesh.faces.size() * 6);
226 EXPECT_EQ(result.face_view_ids.size(), mesh.faces.size());
227
228 // Both faces should be assigned to view 0.
229 EXPECT_EQ(result.face_view_ids[0], 0);
230 EXPECT_EQ(result.face_view_ids[1], 0);
231
232 // All UVs should be in [0, 1].
233 for (size_t i = 0; i < result.face_uvs.size(); ++i) {
234 EXPECT_GE(result.face_uvs[i], 0.0f);
235 EXPECT_LE(result.face_uvs[i], 1.0f);
236 }
237
238 // Atlas should contain approximately the red color.
239 // Check a pixel that should be baked.
240 bool found_colored_pixel = false;
241 for (int y = 0; y < result.atlas_height && !found_colored_pixel; ++y) {
242 for (int x = 0; x < result.atlas_width && !found_colored_pixel; ++x) {
243 const auto color = result.texture_atlas.GetPixel(x, y);
244 if (color && color->r > 100 && color->g < 150 && color->b < 150) {
245 found_colored_pixel = true;
246 }
247 }
248 }
249 EXPECT_TRUE(found_colored_pixel);
250}
251
252TEST(MeshTextureMapping, EmptyMesh) {
253 PlyMesh mesh;

Callers

nothing calls this directly

Calls 14

MakeTriangleMeshFunction · 0.85
MakeTestImageFunction · 0.85
MeshTextureMappingFunction · 0.85
MakeBehindCameraImageFunction · 0.85
PlyMeshVertexClass · 0.85
PlyMeshFaceClass · 0.85
MakeGrazingAngleImageFunction · 0.85
MakeCubeMeshFunction · 0.85
MakePyramidMeshFunction · 0.85
sizeMethod · 0.80
GetPixelMethod · 0.80
emptyMethod · 0.80

Tested by

no test coverage detected