Claude: Findet .npz Fehler

This commit is contained in:
chk
2026-06-01 20:47:39 +02:00
parent a38886ce03
commit 4b5108aaa8
113 changed files with 50858 additions and 2470 deletions

View File

@@ -465,22 +465,35 @@ CALIBRATION_OUTPUT = str(
render = scene.render
cam = cam_obj.data
width_px = render.resolution_x
height_px = render.resolution_y
scale = render.resolution_percentage / 100.0
width_px = render.resolution_x * scale
height_px = render.resolution_y * scale
width_px *= scale
height_px *= scale
focal_mm = cam.lens
sensor_width_mm = cam.sensor_width
sensor_height_mm = cam.sensor_height
focal_mm = cam.lens
# Pixel aspect ratio (1.0 for synthetic cameras with square pixels)
pixel_aspect_ratio = render.pixel_aspect_y / render.pixel_aspect_x
# focal length in pixels
fx = (width_px * focal_mm) / sensor_width_mm
fy = (height_px * focal_mm) / sensor_height_mm
# Blender's 'sensor_fit' decides which sensor axis defines the focal length.
# With AUTO it is the longer (pixel-aspect-weighted) image axis, and pixels are
# square (fy == fx). The previous code used sensor_height for fy, which only
# matched at a 3:2 aspect ratio and was ~15% off at 16:9 (e.g. 1280x720).
sensor_fit = cam.sensor_fit
if sensor_fit == 'AUTO':
sensor_fit = 'HORIZONTAL' if width_px >= height_px * pixel_aspect_ratio else 'VERTICAL'
if sensor_fit == 'HORIZONTAL':
sensor_size_mm = sensor_width_mm
view_fac_px = width_px
else: # VERTICAL
sensor_size_mm = sensor_height_mm
view_fac_px = pixel_aspect_ratio * height_px
f_px = focal_mm * view_fac_px / sensor_size_mm
fx = f_px
fy = f_px / pixel_aspect_ratio # square pixels => fy == fx
cx = width_px / 2.0
cy = height_px / 2.0