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

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: default avatarClaude <claude@elphel.com>
parent 00a639ff
Loading
Loading
Loading
Loading
+10 −3
Original line number Original line Diff line number Diff line
@@ -190,14 +190,21 @@ def parse_images_txt(path):
            i += 2
            i += 2
            continue
            continue
        m    = re.search(r'frame_(\d+)', name)
        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)
        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),
                        'center': colmap_center(R_cw, tx, ty, tz),
                        'R_cw': R_cw,
                        'R_cw': R_cw,
                        'qw': qw, 'qx': qx, 'qy': qy, 'qz': qz})
                        'qw': qw, 'qx': qx, 'qy': qy, 'qz': qz})
        i += 2  # skip POINTS2D line
        i += 2  # skip POINTS2D line
    entries.sort(key=lambda e: e['frame'])
    entries.sort(key=lambda e: e['sort_key'])
    return entries
    return entries