Since you are here, I suppose that you have gone through Part1 and Part2 of this series and, hopefully, found them beneficial. As I promised in part 2 of this series, here is a new article which will help you prepare for your next Computer Vision/Image Processing coding interview.
The main two sections of this article are:
1. Implementation for Gaussian blur with support to gray scale and colored images.
2. Find the closest face to the camera.
Gaussian blur filter is one of the smoothing filters. The smoothing effect is the result of blurring the image by convolving the famous Gaussian function.
Smoothing filters are used usually to reduce the noise in the image. The Gaussian blur filter’s size must be positive and odd and the width and height are not required to match.
For simplicity, our implementation of the Gaussian blur filter in this tutorial will deal with:
- [0–255] values for the pixels.
- Supporting both 1-channel and 3-channel images.
- Using data raw pointer provided by cv::Mat .
- Filter size is a squared shape.
- Boundary pixel values will keep their values (challenge yourself and try to expand the image and apply the filter on boundary pixels as well).
Gaussian Blur Kernel
As mentioned in the previous section, Gaussian Filter works by applying the convolution operation on the image. Gaussian kernel size (width and height) can differ but they both must be positive and odd. Our implementation will support a square kernel only(challenge yourself and support different width and height. easy, right? ^_^ ). Looking back into the Gaussian function, you can notice that in addition to the filter size, we need sigma as a…