Fix #92287: focal legth not correctly computed when tracking vertial videos
The motion tracking always operates with horizontal sensor mapping, but conversion code form tracking camera to Blender camera was not setting the sensor fitting to Horizontal (Python code was leaving sensor fitting unchanged, C code was setting it to Auto). Additionally, the Python code was not handling camera shift, making it so non-centered optical center was not handled correctly. The reason why the code is written in two places is because C code is used when conversion from tracking camera to Blender happens after solving the motion, and the Python code is used for the "Setup Tracking Scene". It is possible to unify some code, but it is not that much of an importance at this time. Pull Request: https://projects.blender.org/blender/blender/pulls/114253
This commit is contained in:
parent
3a312babe6
commit
d7b7938706
|
@ -609,8 +609,18 @@ class CLIP_OT_setup_tracking_scene(Operator):
|
|||
con.influence = 1.0
|
||||
|
||||
cam.sensor_width = tracking.camera.sensor_width
|
||||
cam.sensor_fit = 'HORIZONTAL'
|
||||
cam.lens = tracking.camera.focal_length
|
||||
|
||||
# Convert shift from motion tracking to Blender camera.
|
||||
# Note that the normalization always happens along the X axis. This is
|
||||
# how the camera shift in Blender is denoted.
|
||||
width = clip.size[0]
|
||||
height = clip.size[1]
|
||||
principal_point_px = tracking.camera.principal_point_pixels
|
||||
cam.shift_x = (0.5 * width - principal_point_px[0]) / width
|
||||
cam.shift_y = (0.5 * height - principal_point_px[1]) / width
|
||||
|
||||
@staticmethod
|
||||
def _setupViewport(context):
|
||||
sc = context.space_data
|
||||
|
|
|
@ -2124,7 +2124,7 @@ void BKE_tracking_camera_to_blender(
|
|||
float focal = tracking->camera.focal;
|
||||
|
||||
camera->sensor_x = tracking->camera.sensor_width;
|
||||
camera->sensor_fit = CAMERA_SENSOR_FIT_AUTO;
|
||||
camera->sensor_fit = CAMERA_SENSOR_FIT_HOR;
|
||||
camera->lens = focal * camera->sensor_x / width;
|
||||
|
||||
scene->r.xsch = width;
|
||||
|
|
Loading…
Reference in New Issue