Glow

Applies glow effect to the initial image

int glow(cv::InputArray src, cv::OutputArray dst, int radius=0, float intensity=0.0f)
Parameters:
  • src – RGB image.
  • dst – Destination image of the same size and the same type as src.
  • radius – Radius of box filter kernel, must be positive integer number
  • intensity – Effect intensity, must be real number from 0.0 to 1.0
Returns:

Error code.

The algorithm.

  1. Create the copy of the source image

  2. Apply box filter for this copy with deviation equal sigma

  3. Create new 3-channel image, each channel of the matrix calculates by the following formula:

    \[\begin{split}C = \begin{cases} 2 * A * B, & \text{if $B <= 0.5$}\\ 1 - 2 * (1 - A) * (1 - B), & \text{otherwise} \end{cases}\end{split}\]

    where \(A\) is the pixel’s tonal value that lies in the blurred image, \(B\) is the pixel’s tonal value that lies in the source image, \(C\) is the tonal value of the blended pixel.

  4. Create new 3-channel image, each channel of the matrix calculates by the following formula:

    \[C = intensity * A + (1 - intensity) * B\]

    where \(A\) is the pixel’s tonal value that lies in the previous blended image, \(B\) is the pixel’s tonal value that lies in the source image, \(C\) is the tonal value of the blended pixel.

  5. Save previous image as RGB image

Example.

src dst