1
0

un-fisheye filter for gopro 8:7 ratio, wide fov, without hypersmooth

This commit is contained in:
Roz K 2025-06-07 19:02:17 +02:00
parent e6327cbae5
commit 1f8cb47a11
Signed by: roz
GPG Key ID: 51FBF4E483E1C822
2 changed files with 38 additions and 2 deletions

View File

@ -1,3 +1,6 @@
# avidemux_shaders # Avidemux Shaders
Shaders for avidemux Shaders for Avidemux with OpenGL support
```unfish_gopro_8-7_wide_hypersmooth-off.glsl```
Fisheye removal for GoPro, 8:7 aspect ratio, wide FOV, HyperSmooth off

View File

@ -0,0 +1,33 @@
// Adapted from https://github.com/duducosmos/defisheye
// (then resize to 1568x1080)
#extension GL_ARB_texture_rectangle: enable
uniform sampler2DRect myTextureY;
uniform sampler2DRect myTextureU;
uniform sampler2DRect myTextureV;
uniform vec2 myResolution;
uniform float pts;
const vec2 half_pixel = vec2(0.5, 0.5);
const float pi = 3.1415927;
const float input_fov = 150.0 * pi / 720.0;
const float output_fov = 116.0 * pi / 360.0;
vec2 unfish(vec2 coord) {
vec2 center = myResolution * 0.5;
vec2 pos = coord - center;
float rd = length(pos);
float diameter = sqrt(dot(myResolution, myResolution));
return center + pos * ((diameter / (2.0 * sin(input_fov))) * sin(atan(rd / (diameter / (2.0 * tan(output_fov)))) * 0.5) / rd);
}
void main() {
vec2 y_coord = unfish(gl_TexCoord[0].xy + half_pixel);
vec2 uv_coord = y_coord * 0.5;
vec4 y = texture2DRect(myTextureY, y_coord);
vec4 u = texture2DRect(myTextureU, uv_coord);
vec4 v = texture2DRect(myTextureV, uv_coord);
gl_FragColor = vec4(y.r, u.r, v.r, 1.0);
}