- The simplest
**filter**is a point operator. Each pixel value is multiplied by a scalar value. This operation can be written as follows: Here: The input image is F and the value of pixel at (i,j) is denoted as f (i,j) The output image is G and the value of pixel at (i,j) is denoted as g (i,j) K is scalar constant. This type of operation on an image ... **OpenCV**provides a function cv.filter2D () to convolve a kernel with an image. As an example, we will try an averaging**filter**on an image. A 5x5 averaging**filter**kernel will look like the below: The operation works like this: keep this kernel above a pixel, add all the 25 pixels below this kernel, take the average, and replace the central pixel ...- Secondly, NumPy arrays (the underlying format of
**OpenCV**images in**Python**) are optimized for array calculations, so accessing and modifying each image[c,r] pixel separately will be really slow. Instead, we should realize that the <<8 operation is the same as multiplying the pixel value with the number 2^8=256 , and that pixel-wise division can be achieved with the cv2.divide function. - Secondly, NumPy arrays (the underlying format of
**OpenCV**images in**Python**) are optimized for array calculations, so accessing and modifying each image[c,r] pixel separately will be really slow. Instead, we should realize that the <<8 operation is the same as multiplying the pixel value with the number 2^8=256 , and that pixel-wise division can be achieved with the cv2.divide function. **Gaussian****Filter**. The**gaussian**operator is a way of blurring an input image by controlling it using $\sigma$. You can change the values of $\sigma$. The operator is defined as: It can also be used as a highpass**filter**to sharpen an image using: In the next section we are going to implement the above operators.**Python**Implementation