v2.0, better quality, less perspective deformation #1
@ -1,12 +1,14 @@
|
||||
#version 130
|
||||
// RozK
|
||||
// Fisheye removal for GoPro 11+, 8:7 ratio, without hypersmooth
|
||||
|
||||
#extension GL_ARB_texture_rectangle: enable
|
||||
|
||||
// TODO: investigate
|
||||
// precision highp float;
|
||||
#undef highp // defined by Qt-OpenGl
|
||||
#define rotate_180
|
||||
//#define debug_borders
|
||||
|
||||
// #define debug_borders
|
||||
precision highp float;
|
||||
|
||||
// uniforms
|
||||
uniform sampler2DRect myTextureY;
|
||||
@ -35,6 +37,9 @@ vec2 sensor_to_texture;
|
||||
void initialize() {
|
||||
texture_center = myResolution * 0.5;
|
||||
texture_to_sensor = (sensor_size / myResolution) * pixel_scale;
|
||||
#ifdef rotate_180
|
||||
texture_to_sensor *= -1.0;
|
||||
#endif
|
||||
sensor_to_texture = (myResolution / sensor_size);
|
||||
}
|
||||
|
||||
@ -53,7 +58,7 @@ vec4 unfish_pixel(const in vec2 coord) {
|
||||
|
||||
#ifdef debug_borders
|
||||
if (y_coord.x < 0.0 || y_coord.y < 0.0 || y_coord.x > myResolution.x || y_coord.y > myResolution.y) {
|
||||
return vec4(1.0, 1.0, 1.0, 1.0);
|
||||
return vec4(1.0);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -70,7 +75,7 @@ void main() {
|
||||
initialize();
|
||||
|
||||
vec2 coord = gl_TexCoord[0].xy;
|
||||
vec4 pixel = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
vec4 pixel = vec4(0.0);
|
||||
|
||||
for (int y = 0; y < subsampling; y++) {
|
||||
for (int x = 0; x < subsampling; x++) {
|
||||
|
||||
Reference in New Issue
Block a user