MCPcopy Create free account
hub / github.com/CUT3R/CUT3R / read_model

Function read_model

datasets_preprocess/read_write_model.py:488–507  ·  view source on GitHub ↗
(path, ext="")

Source from the content-addressed store, hash-verified

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

Callers 2

runFunction · 0.85
mainFunction · 0.85

Calls 8

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
printFunction · 0.50

Tested by

no test coverage detected