1
0

focal length, preset and license

This commit is contained in:
2025-09-20 12:53:45 +02:00
parent acd59515aa
commit 676e63eae5
5 changed files with 828 additions and 103 deletions

View File

@ -1,4 +1,18 @@
# RozK
# Fisheye removal for GoPro 11+, 8:7 ratio, without hypersmooth
# Copyright (C) 2025 Jean-Baptiste Berlioz
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import math
@ -38,7 +52,7 @@ print("gopro size : horizontal = %7.3f, vertical = %7.3f, diagonal = %7.3f (mm)
# https://thinglabs.io/gopro-focal-radius-guide
gopro_focal_length = 2.92 # mm
gopro_focal_length = 3.02 # mm
gopro_radius_horizontal = gopro_size_horizontal * 0.5
gopro_radius_vertical = gopro_size_vertical * 0.5
@ -84,19 +98,23 @@ print("linear fov : horizontal = %7.3f, vertical = %7.3f, diagonal = %7.3f (deg
print("\n--- shader parameters ---\n")
rectilinear_angle_horizontal = rectilinear_angle(gopro_radius_horizontal, rectilinear_focal_length_horizontal)
preserved_radius_horizontal = rectilinear_radius(rectilinear_angle_horizontal, rectilinear_focal_length_vertical)
pixel_scale = gopro_radius_horizontal / preserved_radius_horizontal
print("""// parameters
const vec2 sensor_size = vec2(%.6f, %.6f);
const vec2 pixel_scale = vec2(%.6f, 1.0);
const float equidistant_focal_length = %.6f;
const float rectilinear_focal_length = %.6f;
""" % (
gopro_size_horizontal, gopro_size_vertical,
pixel_scale,
gopro_focal_length,
rectilinear_focal_length_vertical)
)
print("\n--- filter parameters 4K ---\n")
width_scale = rectilinear_focal_length_vertical / rectilinear_focal_length_horizontal
output_height = 2160
output_width = int(round((output_height / 7.0) * 8.0 * width_scale))
print("resize: width = %d, height = %d" % (
output_width,
output_height))