MCPcopy Create free account
hub / github.com/ComputationalRobotics/XM-code / load_image_data

Function load_image_data

utils/readgt_colmap.py:66–91  ·  view source on GitHub ↗
(file_path)

Source from the content-addressed store, hash-verified

64 return results
65
66def load_image_data(file_path):
67 with open(file_path, 'r') as file:
68 lines = file.readlines()
69 count = 0
70 image_data = []
71 for i in range(len(lines)):
72 line = lines[i].strip()
73 if line.startswith("#") or not line.strip():
74 continue
75 count = count + 1
76 if(count % 2 == 0):
77 continue
78 # IMAGE_ID, QW, QX, QY, QZ, TX, TY, TZ, CAMERA_ID, NAME
79 parts = line.split()
80 image_id = int(parts[0]) # IMAGE_ID
81 qw, qx, qy, qz = map(float, parts[1:5]) # quat
82 tx, ty, tz = map(float, parts[5:8]) # trans
83 camera_id = int(parts[8]) # CAMERA_ID
84 name = parts[9] # IMAGE NAME
85
86 pose = {"qw": qw, "qx": qx, "qy": qy, "qz": qz, "tx": tx, "ty": ty, "tz": tz}
87 image_data.append((name, image_id, camera_id, pose))
88
89 df = pd.DataFrame(image_data, columns=['NAME', 'IMAGE_ID', 'CAMERA_ID', 'POSE'])
90 df.set_index('NAME', inplace=True)
91 return df
92
93def load_gt_depth(gt_path):
94 image_path = gt_path + "/images.txt"

Callers 2

load_gt_depthFunction · 0.85
load_colmap_gtFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected