focal length and remove cropping
This commit is contained in:
		@ -101,16 +101,9 @@ adm.videoCodec(
 | 
				
			|||||||
    "ratecontrol.lookahead=40")
 | 
					    "ratecontrol.lookahead=40")
 | 
				
			||||||
adm.addVideoFilter(
 | 
					adm.addVideoFilter(
 | 
				
			||||||
    "shaderLoader", "shaderFile=/opt/rk/avidemux/unfish_gopro_8:7.glsl")
 | 
					    "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(
 | 
					adm.addVideoFilter(
 | 
				
			||||||
    "swscale",
 | 
					    "swscale",
 | 
				
			||||||
    "width=2880",
 | 
					    "width=2832",
 | 
				
			||||||
    "height=2160",
 | 
					    "height=2160",
 | 
				
			||||||
    "algo=2",
 | 
					    "algo=2",
 | 
				
			||||||
    "sourceAR=0",
 | 
					    "sourceAR=0",
 | 
				
			||||||
 | 
				
			|||||||
@ -37,9 +37,9 @@ uniform float pts;
 | 
				
			|||||||
// parameters
 | 
					// parameters
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const vec2  sensor_size              = vec2(5.949440, 5.205760);
 | 
					const vec2  sensor_size              = vec2(5.949440, 5.205760);
 | 
				
			||||||
const vec2  rectilinear_scale        = vec2(1.138819, 1.0);
 | 
					const vec2  rectilinear_scale        = vec2(1.147370, 1.0);
 | 
				
			||||||
const float equidistant_focal_length = 2.970000;
 | 
					const float equidistant_focal_length = 2.920000;
 | 
				
			||||||
const float rectilinear_focal_length = 2.167601;
 | 
					const float rectilinear_focal_length = 2.102263;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// constants
 | 
					// constants
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -41,7 +41,7 @@ print("gopro  size : horizontal = %7.3f, vertical = %7.3f, diagonal = %7.3f (mm)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# https://thinglabs.io/gopro-focal-length-guide
 | 
					# 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_horizontal = gopro_size_horizontal * 0.5
 | 
				
			||||||
gopro_radius_vertical   = gopro_size_vertical   * 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
 | 
					output_scale_horizontal = output_size_horizontal / gopro_size_horizontal
 | 
				
			||||||
 | 
					
 | 
				
			||||||
print("""// parameters
 | 
					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 equidistant_focal_length = %.6f;
 | 
				
			||||||
const float rectilinear_focal_length = %.6f;
 | 
					const float rectilinear_focal_length = %.6f;""" % (
 | 
				
			||||||
const vec2 rectilinear_scale = vec2(%.6F, 1.0);""" % (
 | 
					 | 
				
			||||||
    gopro_size_horizontal, gopro_size_vertical,
 | 
					    gopro_size_horizontal, gopro_size_vertical,
 | 
				
			||||||
 | 
					    output_scale_horizontal,
 | 
				
			||||||
    gopro_focal_length,
 | 
					    gopro_focal_length,
 | 
				
			||||||
    rectilinear_focal_length_vertical,
 | 
					    rectilinear_focal_length_vertical)
 | 
				
			||||||
    output_scale_horizontal)
 | 
					 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
print("\n--- filters parameters ---\n")
 | 
					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):
 | 
					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" % (
 | 
					    print("resize: width = %d, height = %d" % (
 | 
				
			||||||
        round(array_horizontal / 4.0) * 4,
 | 
					        round(array_horizontal / 4.0) * 4,
 | 
				
			||||||
        array_vertical))
 | 
					        array_vertical))
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user