What's happening underneath?
The vignette filter basically focuses the brightness on a particular part of the image and the other parts look faded. In order to achieve this, we need to filter out each channel in the image using a Gaussian kernel. OpenCV provides a function to do this, which is called getGaussianKernel. We need to build a 2D kernel whose size matches the size of the image. The second parameter of the function, getGaussianKernel, is interesting. It is the standard deviation of the Gaussian, and it controls the radius of the bright central region. You can play around with this parameter and see how it affects the output.
Once we build the 2D kernel, we need to build a mask by normalizing this kernel and scaling it up, as shown ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access