GLIP-Lib is built around OpenGL shaders and the Shading Language (GLSL). A shader is a small program which is used to process large and uniform data sets. Typically in 3D engines (inside video games, modelers, CAD or medical imagery softwares), shaders are used to manipulate vertices, geometry elements and pixels. The name comes from one of their primary usage : shading elements in a scene. The vocabulary used in all of this documentation will be voluntarily close to OpenGL's own terminology as it is the founding component.
The library processes images through filter. Each filter can have one shader per data type : the vertex shader will be applied to tranform the vertices (support of the in put images); the fragment shader will be called for writing pixels (or fragments) to the output image (or framebuffer).
Each and every output pixel covered by the geometry will result in a call to a fragment shader (if one is bound to the current filter). The call to the a shader can perform complex operations on the input data but it cannot :
These restrictions are the key to parallel and fast operations on GPUs. This being said, a shader can :
We can choose the geometry to fit the output image and illustrate the previous capabilities with the following figure :
We can have a look at a very simple shader example, to generate a colored disc over some background :
The images generated (256x256 pixels, RGB 8bits; left : without anti-aliasing, right : with anti-aliasing) :
For more information on the GLSL language, please visit https://www.opengl.org/documentation/glsl/ and https://www.opengl.org/sdk/docs/man4/index.php.
We could also read from an image and modify the pixels before writting them to the output image :
The images generated taking the previous as inputs (left : without anti-aliasing, right : with anti-aliasing) :
GLIP-Lib does also allow for the constructions of pipelines. There are made of a group of filters (possibly sub-pipelines) sharing connections, a set of input ports and a set of output ports. We can represent examples of these constructs as follow :
GLIP-Lib relies on GLSL for the shader sources and provides a container syntax to quickly prototype filters and pipelines. These scripts allow the user to create complete processing structures readable by the library. Re-using the previous disc example, we write the corresponding pipeline script :
Similarly, for the negative filter :
You can find a detailed documentation on this language in the following pages : Glip::Modules::LayoutLoader, Glip::Modules::LayoutLoaderModule. Further examples are also built with these scripts.