Tracking: Store lens principal point in normalized space

This avoids need to do special trickery detecting whether the principal
point is to be changed when reloading movie clip. This also allows to
transfer the optical center from high-res footage to possibly its lower
resolution proxy without manual adjustment.

On a user level the difference is that the principal point is exposed in
the normalized coordinates: frame center has coordinate of (0, 0), left
bottom corner of a frame has coordinate of (-1, -1) and the right top
corner has coordinate of (1, 1).

Another user-visible change is that there is no more operator for setting
the principal point to center: use backspace on the center sliders will
reset values to 0 which corresponds to the center.

The code implements versioning in both directions, so it should be
possible to open file in older Blender versions without loosing
configuration.

For the Python API there are two ways to access the property:
- `tracking.camera.principal_point` which is measured in the normalized
  space.
- `tracking.camera.principal_point_pixels` to access the pixel-space
  principal point.

Both properties are not animatable, so there will by no conflict coming.

Differential Revision: https://developer.blender.org/D16573
This commit is contained in:
2022-11-18 17:15:13 +01:00
parent 04dc58df83
commit 7dea18b3aa
14 changed files with 200 additions and 103 deletions

View File

@@ -920,8 +920,7 @@ class CLIP_PT_tracking_lens(Panel):
col.prop(camera, "units", text="Units")
col = layout.column()
col.prop(clip.tracking.camera, "principal", text="Optical Center")
col.operator("clip.set_center_principal", text="Set Center")
col.prop(clip.tracking.camera, "principal_point", text="Optical Center")
col = layout.column()
col.prop(camera, "distortion_model", text="Lens Distortion")
@@ -1353,7 +1352,6 @@ class CLIP_MT_clip(Menu):
if clip:
layout.operator("clip.set_scene_frames")
layout.operator("clip.set_center_principal")
layout.operator("clip.prefetch")
layout.operator("clip.reload")
layout.menu("CLIP_MT_proxy")