MCPcopy Create free account
hub / github.com/ai4ce/RAP / read_model

Function read_model

utils/read_write_model.py:489–508  ·  view source on GitHub ↗
(path, ext="")

Source from the content-addressed store, hash-verified

487
488
489def read_model(path, ext=""):
490 # try to detect the extension automatically
491 if ext == "":
492 if detect_model_format(path, ".bin"):
493 ext = ".bin"
494 elif detect_model_format(path, ".txt"):
495 ext = ".txt"
496 else:
497 print("Provide model format: '.bin' or '.txt'")
498 return
499
500 if ext == ".txt":
501 cameras = read_cameras_text(os.path.join(path, "cameras" + ext))
502 images = read_images_text(os.path.join(path, "images" + ext))
503 points3D = read_points3D_text(os.path.join(path, "points3D") + ext)
504 else:
505 cameras = read_cameras_binary(os.path.join(path, "cameras" + ext))
506 images = read_images_binary(os.path.join(path, "images" + ext))
507 points3D = read_points3D_binary(os.path.join(path, "points3D") + ext)
508 return cameras, images, points3D
509
510
511def write_model(cameras, images, points3D, path, ext=".bin"):

Callers 1

Calls 8

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

Tested by

no test coverage detected