Commit 2f169094 authored by Andrey Filippov's avatar Andrey Filippov

CLAUDE: fopen_pose_compare.py — handle timestamp-named COLMAP images

parse_images_txt() now accepts both frame_NNN names and timestamp names
(e.g. 1763232419_474661.png). Introduces sort_key (float) so entries
sort correctly regardless of naming style. fno stays -1 for timestamp
images since no integer frame number is present.
Co-authored-by: 's avatarClaude <claude@elphel.com>
parent 00a639ff
......@@ -190,14 +190,21 @@ def parse_images_txt(path):
i += 2
continue
m = re.search(r'frame_(\d+)', name)
fno = int(m.group(1)) if m else -1
if m:
fno = int(m.group(1))
sort_key = float(fno)
else:
# Timestamp-named images: "1763232419_474661.png" → 1763232419.474661
mt = re.match(r'(\d+)_(\d+)\.png', name)
sort_key = float(mt.group(1) + '.' + mt.group(2)) if mt else 0.0
fno = -1
R_cw = quat_to_R(qw, qx, qy, qz)
entries.append({'frame': fno, 'name': name,
entries.append({'frame': fno, 'name': name, 'sort_key': sort_key,
'center': colmap_center(R_cw, tx, ty, tz),
'R_cw': R_cw,
'qw': qw, 'qx': qx, 'qy': qy, 'qz': qz})
i += 2 # skip POINTS2D line
entries.sort(key=lambda e: e['frame'])
entries.sort(key=lambda e: e['sort_key'])
return entries
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment