Forum

Author Topic: How it is possible that not every projection has a dedicated point?  (Read 14970 times)

avolodin

  • Newbie
  • *
  • Posts: 18
    • View Profile
I'm writing this code:

Code: [Select]
track_to_point = {}
for point in chunk.tie_points.points:
    if point.valid:
        track_to_point[point.track_id] = point

for cam in chunk.cameras:
    for proj in chunk.tie_points.projections[cam]:
        print(point.valid)
        point = track_to_point[proj.track_id]
        print(cam.error(point.coord, proj.coord))

but getting this error:

Code: [Select]
True
Vector([0.0016539822611321142, -0.2568514806081339])
True
Vector([0.002596917770802065, -0.29048097945792506])
True
Vector([0.00011575210442060779, -0.01776533600843777])
True
Vector([-0.0011434071481062347, 0.15396162616718811])
True
Vector([0.003877099283613461, -0.6481303187979393])
True
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[22], line 9
      7 for proj in chunk.tie_points.projections[cam]:
      8     print(point.valid)
----> 9     point = track_to_point[proj.track_id]
     10     print(cam.error(point.coord, proj.coord))

KeyError: 5

how is it possible that not every projection has its own dedicated point?

vineg

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: How it is possible that not every projection has a dedicated point?
« Reply #1 on: July 08, 2025, 06:09:00 PM »
Hi!

Maybe some points are invalid (point.valid condition is False)?
Note that you are printing "valid" field for the point from the previous iteration.