Utilitary classes for image-processing: blur, bloom etc. Using C++, SFML, OpenGL shaders.
Directional gaussian blur. Two parameters:
- force of the blur
- direction of the blur
Gaussian blur for 2D images, implemented as two orthogonal directional blurs.
For better performance, the texture can be downscaled, blurred and then upscaled. Typically, shrinking the blurred texture by x2 enables x5,x6 performance for a visually equivalent result.
Measure performance, for x16 blur of a 512x512 image: Blur without downscaling: 3.3ms Blur with x4 downscaling: 0.55ms
Extracts the bright parts of an image, sets the other parts to black. Only the perceived brightness is taken into account: perceived brightness = 0.299red + 0.587green + 0.114*blue.
Wikipedia: The effect produces fringes (or feathers) of light extending from the borders of bright areas in an image.
Processes the image in three steps:
- extracts the bright parts to a buffer texture
- blurs the buffer
- adds the buffer to the original image
This post-treatment automatically detects strong color gradient. It can be used to generate a normal map from a height map. Otherwise if we apply a threshold on the gradient's norm, it becomes a contour extractor that can later be used for image segmentation. The only parameter is then the threshold value.