Compare commits
	
		
			3 Commits
		
	
	
		
			64e693fe4a
			...
			71cca0589e
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						
						
							
						
						71cca0589e
	
				 | 
					
					
						|||
| 
						
						
							
						
						67b60b0e69
	
				 | 
					
					
						|||
| 
						
						
							
						
						79b66d47ee
	
				 | 
					
					
						
@ -68,7 +68,7 @@ vec3 sample_texture(const in vec2 coord) {
 | 
				
			|||||||
    vec2 y_coord = texture_center + rectilinear * sensor_to_texture;
 | 
					    vec2 y_coord = texture_center + rectilinear * sensor_to_texture;
 | 
				
			||||||
#ifdef debug_borders
 | 
					#ifdef debug_borders
 | 
				
			||||||
    if (y_coord.x < 0.0 || y_coord.y < 0.0 || y_coord.x > myResolution.x || y_coord.y > myResolution.y) {
 | 
					    if (y_coord.x < 0.0 || y_coord.y < 0.0 || y_coord.x > myResolution.x || y_coord.y > myResolution.y) {
 | 
				
			||||||
        return vec3(1.0);
 | 
					        return vec3(16.0 / 255.0, 0.5, 0.5);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
    vec2 uv_coord = y_coord * 0.5;
 | 
					    vec2 uv_coord = y_coord * 0.5;
 | 
				
			||||||
@ -99,15 +99,15 @@ vec3 decode_pixel(const in vec3 pixel) {
 | 
				
			|||||||
    return vec3(l, color.yz);
 | 
					    return vec3(l, color.yz);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
vec3 encode_pixel(const in vec3 color) {
 | 
					vec3 encode_color(const in vec3 color) {
 | 
				
			||||||
    float y = (color.x < 0.018) ? (color.x * 4.5) : (pow(color.x, 0.45) * 1.099 - 0.099);
 | 
					    float y = (color.x < 0.018) ? (color.x * 4.5) : (pow(color.x, 0.45) * 1.099 - 0.099);
 | 
				
			||||||
    return (vec3(y, color.yz) + yuv_center) * yuv_range + yuv_min;
 | 
					    return (vec3(y, color.yz) + yuv_center) * yuv_range + yuv_min;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define decode_pixel(_color) _color
 | 
					#define decode_pixel(_pixel) _pixel
 | 
				
			||||||
#define encode_pixel(_color) _color
 | 
					#define encode_color(_color) _color
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // non_linear_decoding
 | 
					#endif // non_linear_decoding
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -121,5 +121,5 @@ void main() {
 | 
				
			|||||||
            color += decode_pixel(sample_texture(coord + offset));
 | 
					            color += decode_pixel(sample_texture(coord + offset));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    gl_FragColor = vec4(encode_pixel(color * subsampling_scale), 1.0);
 | 
					    gl_FragColor = vec4(encode_color(color * subsampling_scale), 1.0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -57,7 +57,7 @@ print("gopro  fov  : horizontal = %7.3f, vertical = %7.3f, diagonal = %7.3f (deg
 | 
				
			|||||||
    gopro_fov_vertical,
 | 
					    gopro_fov_vertical,
 | 
				
			||||||
    gopro_fov_diagonal))
 | 
					    gopro_fov_diagonal))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
print("\n--- rectilinear re-projection, preserving vertical fov ---\n")
 | 
					print("\n--- rectilinear re-projection ---\n")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
rectilinear_focal_length = lambda radius: radius * math.tan(math.radians(90.0 - equidistant_angle(radius)))
 | 
					rectilinear_focal_length = lambda radius: radius * math.tan(math.radians(90.0 - equidistant_angle(radius)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -73,14 +73,14 @@ print("linear focal: horizontal = %7.3f, vertical = %7.3f, diagonal = %7.3f (mm)
 | 
				
			|||||||
rectilinear_radius = lambda angle,  focal_length: focal_length * math.tan(math.radians(angle))
 | 
					rectilinear_radius = lambda angle,  focal_length: focal_length * math.tan(math.radians(angle))
 | 
				
			||||||
rectilinear_angle  = lambda radius, focal_length: math.degrees(math.atan(radius / focal_length))
 | 
					rectilinear_angle  = lambda radius, focal_length: math.degrees(math.atan(radius / focal_length))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
preserved_fov_horizontal = 2.0 * rectilinear_angle(gopro_radius_horizontal, rectilinear_focal_length_vertical)
 | 
					rectilinear_fov_horizontal = 2.0 * rectilinear_angle(gopro_radius_horizontal, rectilinear_focal_length_vertical)
 | 
				
			||||||
preserved_fov_vertical   = 2.0 * rectilinear_angle(gopro_radius_vertical,   rectilinear_focal_length_vertical)
 | 
					rectilinear_fov_vertical   = 2.0 * rectilinear_angle(gopro_radius_vertical,   rectilinear_focal_length_vertical)
 | 
				
			||||||
preserved_fov_diagonal   = 2.0 * rectilinear_angle(gopro_radius_diagonal,   rectilinear_focal_length_vertical)
 | 
					rectilinear_fov_diagonal   = 2.0 * rectilinear_angle(gopro_radius_diagonal,   rectilinear_focal_length_vertical)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
print("linear fov  : horizontal = %7.3f, vertical = %7.3f, diagonal = %7.3f (deg)" % (
 | 
					print("linear fov  : horizontal = %7.3f, vertical = %7.3f, diagonal = %7.3f (deg)" % (
 | 
				
			||||||
    preserved_fov_horizontal,
 | 
					    rectilinear_fov_horizontal,
 | 
				
			||||||
    preserved_fov_vertical,
 | 
					    rectilinear_fov_vertical,
 | 
				
			||||||
    preserved_fov_diagonal))
 | 
					    rectilinear_fov_diagonal))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
print("\n--- shader parameters ---\n")
 | 
					print("\n--- shader parameters ---\n")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -93,13 +93,14 @@ const float rectilinear_focal_length = %.6f;""" % (
 | 
				
			|||||||
    rectilinear_focal_length_vertical)
 | 
					    rectilinear_focal_length_vertical)
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
print("\n--- filter parameters 4K ---\n")
 | 
					# print("\n--- filter parameters 4K ---\n")
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
width_scale = rectilinear_focal_length_vertical / rectilinear_focal_length_horizontal
 | 
					# width_scale = rectilinear_focal_length_vertical / rectilinear_focal_length_horizontal
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
output_height = 2160
 | 
					# output_height = 2160
 | 
				
			||||||
output_width  = int(round((output_height / 7.0) * 8.0 * width_scale))
 | 
					# output_width  = int(round((output_height / gopro_array_vertical) * gopro_array_horizontal * width_scale))
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
print("resize: width = %d, height = %d" % (
 | 
					# print("resize: width = %d, height = %d, ratio = %f" % (
 | 
				
			||||||
    output_width,
 | 
					#     output_width,
 | 
				
			||||||
    output_height))
 | 
					#     output_height,
 | 
				
			||||||
 | 
					#     output_width / output_height))
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user