18 #ifndef PIC_GL_FILTERING_FILTER_GROW_CUT_HPP 19 #define PIC_GL_FILTERING_FILTER_GROW_CUT_HPP 21 #include "../../gl/filtering/filter.hpp" 38 uniform sampler2D u_tex; \n
39 uniform sampler2D u_max; \n
40 uniform sampler2D u_state_cur; \n
41 const int dx[8] =
int[](-1, 0, 1, -1, 1, -1, 0, 1); \n
42 const int dy[8] =
int[]( 1, 1, 1, 0, 0, -1, -1, -1); \n
47 ivec2 coords = ivec2(gl_FragCoord.xy); \n
48 vec3 col = texelFetch(u_tex, coords, 0).xyz; \n
49 vec2 cur = texelFetch(u_state_cur, coords, 0).xy; \n
50 vec3 col_max = texelFetch(u_max, coords, 0).xyz; \n
51 float C = dot(col_max, col_max); \n
54 for(
int k = 0; k < 8; k++) {\n
55 ivec2 coords_k = coords + ivec2(dx[k], dy[k]);\n
57 vec2 cur_k = texelFetch(u_state_cur, coords_k, 0).xy; \n
58 vec3 col_k = texelFetch(u_tex, coords_k, 0).xyz; \n
59 vec3 delta_col = col - col_k;\n
60 float g_theta = 1.0 - (dot(delta_col, delta_col) / C);
62 if(g_theta > cur.y) {\n
67 f_color = vec4(next.x, next.y, 0.0, 1.0); \n
~FilterGLGrowCut()
Definition: filter_grow_cut.hpp:87
TechniqueGL technique
Definition: display.hpp:45
void bind()
bind
Definition: display.hpp:189
#define MAKE_STRING(input_string)
The FilterGLGrowCut class.
Definition: filter_grow_cut.hpp:28
The FilterGL class.
Definition: filter.hpp:35
bool initStandard(std::string version_number, std::string vertex_shader_source, std::string fragment_shader_source, std::string name)
initStandard
Definition: display.hpp:114
void unbind()
unbind
Definition: display.hpp:197
void update()
update
Definition: filter_grow_cut.hpp:95
std::string vertex_source
Definition: display.hpp:57
Definition: bilateral_separation.hpp:25
std::string fragment_source
Definition: display.hpp:57
FilterGLGrowCut()
FilterGLGrowCut.
Definition: filter_grow_cut.hpp:82
void initShaders()
initShaders
Definition: filter_grow_cut.hpp:34
void release()
release
Definition: display.hpp:85
void setUniform1i(const char *name_uniform, int value0)
SetUniform.
Definition: display.hpp:236