18 #ifndef PIC_GL_FILTERING_FILTER_DISP_HPP 19 #define PIC_GL_FILTERING_FILTER_DISP_HPP 21 #include "../../gl/filtering/filter.hpp" 69 std::string nameRight,
85 imgOut->
Write(nameOut);
102 uniform sampler2D u_texL; \n
103 uniform sampler2D u_texR; \n
104 uniform sampler2D u_texD; \n
105 uniform
int halfKernelSize; \n
106 uniform
float sigma; \n
107 uniform
float sigma_s2; \n
108 uniform
float sigma_r2; \n
109 uniform
float bUse; \n
110 uniform
float bLeft; \n
113 vec4 fetchDispCol(ivec2 coords) {
114 float shiftf = texelFetch(u_texD, coords, 0).x;
117 coords.x += int(shiftf);
118 vec3 col_R = texelFetch(u_texR, coords, 0).xyz;
119 return vec4(col_R, shiftf);
132 ivec2 coords = ivec2(gl_FragCoord.xy);
135 vec3 acc = vec3(0.0);
137 vec3 refDisp = texelFetch(u_texD, coords, 0).xyz;
138 vec3 refCol = texelFetch(u_texL, coords, 0).xyz;
140 for(
int i = -halfKernelSize; i <= halfKernelSize; i++) {
143 for(
int j = -halfKernelSize; j <= halfKernelSize; j++) {
147 ivec2 tmpCoords = coords + ivec2(j, i);
148 vec3 tmpCol = texelFetch(u_texL, tmpCoords, 0).xyz;
151 vec3 tmpDisp = texelFetch(u_texD, tmpCoords, 0).xyz;
152 tmpCoords.x += int(bLeft * tmpDisp.x);
153 vec3 tmpCol2 = texelFetch(u_texR, tmpCoords, 0).xyz;
156 float ws = exp(-dot(delta, delta) / sigma_s2);
159 float deltaDisp = tmpDisp.x - refDisp.x;
160 float wd = exp(-deltaDisp * deltaDisp / sigma_r2);
163 vec3 diffCol = tmpCol - refCol;
164 float wc = exp(-dot(diffCol, diffCol) /
sigma);
175 acc += tmpCol * w * wc;
182 f_color = vec4(acc, 1.0);
TechniqueGL technique
Definition: display.hpp:45
static int getKernelSize(float sigma)
KernelSize computes the size of a kernel in pixel give its sigma.
Definition: precomputed_gaussian.hpp:121
GLuint generateTextureGL(GLenum target, GLenum format_type, bool mipmap)
generateTextureGL
void bind()
bind
Definition: display.hpp:189
void update(float sigma, float sigma_s, float sigma_r, bool bUse, bool bLeft)
update
#define MAKE_STRING(input_string)
The ImageGL class.
Definition: image.hpp:42
float sigma_r
Definition: filter_disp.hpp:36
FilterGLDisp()
FilterGLDisp.
bool Write(std::string nameFile, LDR_type typeWrite, int writerCounter)
Write saves an Image into a file on the disk.
Definition: filter_radial_basis_function.hpp:1924
void setUniform1f(const char *name_uniform, float value0)
SetUniform1f.
Definition: display.hpp:247
virtual ImageGL * Process(ImageGLVec imgIn, ImageGL *imgOut)
Process.
Definition: display.hpp:258
The FilterGL class.
Definition: filter.hpp:35
The FilterGL class.
Definition: display.hpp:35
The FilterGLDisp class.
Definition: filter_disp.hpp:30
float sigma
Definition: filter_disp.hpp:34
void initShaders()
initShaders
bool initStandard(std::string version_number, std::string vertex_shader_source, std::string fragment_shader_source, std::string name)
initStandard
Definition: display.hpp:114
PIC_INLINE ImageGLVec TripleGL(ImageGL *img1, ImageGL *img2, ImageGL *img3)
TripleGL creates a triple for filters input.
Definition: image_vec.hpp:67
void unbind()
unbind
Definition: display.hpp:197
void loadToMemory()
loadToMemory
std::string vertex_source
Definition: display.hpp:57
Definition: bilateral_separation.hpp:25
static ImageGL * execute(std::string nameLeft, std::string nameRight, std::string nameDisp, std::string nameOut)
execute
Definition: filter_disp.hpp:68
std::string fragment_source
Definition: display.hpp:57
float sigma_s
Definition: filter_disp.hpp:35
void setUniform1i(const char *name_uniform, int value0)
SetUniform.
Definition: display.hpp:236