v2.0, better quality, less perspective deformation #1
@ -103,7 +103,7 @@ adm.addVideoFilter(
 | 
			
		||||
    "shaderLoader", "shaderFile=/opt/rk/avidemux/unfish_gopro_8:7.glsl")
 | 
			
		||||
adm.addVideoFilter(
 | 
			
		||||
    "swscale",
 | 
			
		||||
    "width=2832",
 | 
			
		||||
    "width=2468",
 | 
			
		||||
    "height=2160",
 | 
			
		||||
    "algo=2",
 | 
			
		||||
    "sourceAR=0",
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,7 @@
 | 
			
		||||
 | 
			
		||||
#define color_conversion
 | 
			
		||||
#define texture_filtering
 | 
			
		||||
//#define rotate_180
 | 
			
		||||
#define rotate_180
 | 
			
		||||
//#define debug_borders
 | 
			
		||||
 | 
			
		||||
#undef highp // defined by Qt-OpenGl
 | 
			
		||||
@ -37,7 +37,6 @@ uniform float pts;
 | 
			
		||||
// parameters
 | 
			
		||||
 | 
			
		||||
const vec2  sensor_size              = vec2(5.949440, 5.205760);
 | 
			
		||||
const vec2  rectilinear_scale        = vec2(1.147370, 1.0);
 | 
			
		||||
const float equidistant_focal_length = 2.920000;
 | 
			
		||||
const float rectilinear_focal_length = 2.102263;
 | 
			
		||||
 | 
			
		||||
@ -56,7 +55,7 @@ vec2 sensor_to_texture;
 | 
			
		||||
 | 
			
		||||
void initialize() {
 | 
			
		||||
    texture_center = myResolution * 0.5;
 | 
			
		||||
    texture_to_sensor = (sensor_size / myResolution) * rectilinear_scale;
 | 
			
		||||
    texture_to_sensor = (sensor_size / myResolution);
 | 
			
		||||
#ifdef rotate_180
 | 
			
		||||
    texture_to_sensor *= -1.0;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@ -87,26 +87,19 @@ print("linear fov  : horizontal = %7.3f, vertical = %7.3f, diagonal = %7.3f (deg
 | 
			
		||||
 | 
			
		||||
print("\n--- shader parameters ---\n")
 | 
			
		||||
 | 
			
		||||
output_size_horizontal = 2.0 * rectilinear_radius(gopro_fov_horizontal * 0.5)
 | 
			
		||||
output_size_vertical   = gopro_size_vertical
 | 
			
		||||
 | 
			
		||||
output_scale_horizontal = output_size_horizontal / gopro_size_horizontal
 | 
			
		||||
 | 
			
		||||
print("""// parameters\n
 | 
			
		||||
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;""" % (
 | 
			
		||||
    gopro_size_horizontal, gopro_size_vertical,
 | 
			
		||||
    output_scale_horizontal,
 | 
			
		||||
    gopro_focal_length,
 | 
			
		||||
    rectilinear_focal_length_vertical)
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
print("\n--- filters parameters ---\n")
 | 
			
		||||
print("\n--- output size ---\n")
 | 
			
		||||
 | 
			
		||||
def print_output_array(array_vertical):
 | 
			
		||||
    array_horizontal = (array_vertical / gopro_array_vertical) * gopro_array_horizontal * output_scale_horizontal
 | 
			
		||||
    array_horizontal = (array_vertical / gopro_array_vertical) * gopro_array_horizontal
 | 
			
		||||
    print("resize: width = %d, height = %d" % (
 | 
			
		||||
        round(array_horizontal / 4.0) * 4,
 | 
			
		||||
        array_vertical))
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user