MCPcopy Create free account
hub / github.com/XiaoBaiiiiii/colmap-pcd / read_model

Function read_model

scripts/python/read_write_model.py:419–438  ·  view source on GitHub ↗
(path, ext="")

Source from the content-addressed store, hash-verified

417
418
419def read_model(path, ext=""):
420 # try to detect the extension automatically
421 if ext == "":
422 if detect_model_format(path, ".bin"):
423 ext = ".bin"
424 elif detect_model_format(path, ".txt"):
425 ext = ".txt"
426 else:
427 print("Provide model format: '.bin' or '.txt'")
428 return
429
430 if ext == ".txt":
431 cameras = read_cameras_text(os.path.join(path, "cameras" + ext))
432 images = read_images_text(os.path.join(path, "images" + ext))
433 points3D = read_points3D_text(os.path.join(path, "points3D") + ext)
434 else:
435 cameras = read_cameras_binary(os.path.join(path, "cameras" + ext))
436 images = read_images_binary(os.path.join(path, "images" + ext))
437 points3D = read_points3D_binary(os.path.join(path, "points3D") + ext)
438 return cameras, images, points3D
439
440
441def write_model(cameras, images, points3D, path, ext=".bin"):

Callers 3

read_modelMethod · 0.90
mainFunction · 0.90
mainFunction · 0.85

Calls 7

detect_model_formatFunction · 0.85
read_cameras_textFunction · 0.85
read_images_textFunction · 0.85
read_points3D_textFunction · 0.85
read_cameras_binaryFunction · 0.85
read_images_binaryFunction · 0.85
read_points3D_binaryFunction · 0.85

Tested by 1

mainFunction · 0.72