From d346c69f691dd8067c044d1c0819721f7809d162 Mon Sep 17 00:00:00 2001 From: Roz K Date: Wed, 1 Oct 2025 00:11:30 +0200 Subject: [PATCH] focal length and remove cropping --- gopro_8:7/preset_gopro_8:7.py | 9 +-------- gopro_8:7/unfish_gopro_8:7.glsl | 6 +++--- gopro_8:7/unfish_gopro_8:7.py | 26 +++++++------------------- 3 files changed, 11 insertions(+), 30 deletions(-) diff --git a/gopro_8:7/preset_gopro_8:7.py b/gopro_8:7/preset_gopro_8:7.py index 6dcfc25..f3e5b5d 100644 --- a/gopro_8:7/preset_gopro_8:7.py +++ b/gopro_8:7/preset_gopro_8:7.py @@ -101,16 +101,9 @@ adm.videoCodec( "ratecontrol.lookahead=40") adm.addVideoFilter( "shaderLoader", "shaderFile=/opt/rk/avidemux/unfish_gopro_8:7.glsl") -adm.addVideoFilter( - "crop", - "top=80", - "bottom=0", - "left=0", - "right=0", - "ar_select=0") adm.addVideoFilter( "swscale", - "width=2880", + "width=2832", "height=2160", "algo=2", "sourceAR=0", diff --git a/gopro_8:7/unfish_gopro_8:7.glsl b/gopro_8:7/unfish_gopro_8:7.glsl index 7e69cd3..dbf64a5 100644 --- a/gopro_8:7/unfish_gopro_8:7.glsl +++ b/gopro_8:7/unfish_gopro_8:7.glsl @@ -37,9 +37,9 @@ uniform float pts; // parameters const vec2 sensor_size = vec2(5.949440, 5.205760); -const vec2 rectilinear_scale = vec2(1.138819, 1.0); -const float equidistant_focal_length = 2.970000; -const float rectilinear_focal_length = 2.167601; +const vec2 rectilinear_scale = vec2(1.147370, 1.0); +const float equidistant_focal_length = 2.920000; +const float rectilinear_focal_length = 2.102263; // constants diff --git a/gopro_8:7/unfish_gopro_8:7.py b/gopro_8:7/unfish_gopro_8:7.py index 2b4dd8a..b4b5ff2 100644 --- a/gopro_8:7/unfish_gopro_8:7.py +++ b/gopro_8:7/unfish_gopro_8:7.py @@ -41,7 +41,7 @@ print("gopro size : horizontal = %7.3f, vertical = %7.3f, diagonal = %7.3f (mm) # https://thinglabs.io/gopro-focal-length-guide -gopro_focal_length = 2.97 # mm +gopro_focal_length = 2.92 gopro_radius_horizontal = gopro_size_horizontal * 0.5 gopro_radius_vertical = gopro_size_vertical * 0.5 @@ -93,32 +93,20 @@ output_size_vertical = gopro_size_vertical output_scale_horizontal = output_size_horizontal / gopro_size_horizontal print("""// parameters -const vec2 sensor_size = vec2(%.6f, %.6f); +const vec2 sensor_size = vec2(%.6f, %.6f); +const vec2 rectilinear_scale = vec2(%.6f, 1.0); const float equidistant_focal_length = %.6f; -const float rectilinear_focal_length = %.6f; -const vec2 rectilinear_scale = vec2(%.6F, 1.0);""" % ( +const float rectilinear_focal_length = %.6f;""" % ( gopro_size_horizontal, gopro_size_vertical, + output_scale_horizontal, gopro_focal_length, - rectilinear_focal_length_vertical, - output_scale_horizontal) + rectilinear_focal_length_vertical) ) print("\n--- filters parameters ---\n") -output_ratio_horizontal = 4.0 -output_ratio_vertical = 3.0 - -output_crop_ratio = output_ratio_vertical / (output_ratio_horizontal / output_scale_horizontal) - -output_crop_horizontal = gopro_texture_horizontal -output_crop_vertical = output_crop_horizontal * output_crop_ratio - -print("crop : width = %d, height = %d" % ( - output_crop_horizontal, - round(output_crop_vertical))) - def print_output_array(array_vertical): - array_horizontal = (array_vertical / output_ratio_vertical) * output_ratio_horizontal + array_horizontal = (array_vertical / gopro_array_vertical) * gopro_array_horizontal * output_scale_horizontal print("resize: width = %d, height = %d" % ( round(array_horizontal / 4.0) * 4, array_vertical))