Bilateral Filtering
A bilateral filter is used for smoothening images and reducing noise while preserving edges. However, these convolutions often result in a loss of important edge information, since they blur out everything, irrespective of it being noise or an edge. To counter this problem, the non-linear bilateral filter was introduced. OpenCV has a function called bilateralFilter() with the following arguments:
- d: Diameter of each pixel neighborhood.
- sigmaColor: Value of in the color space. The greater the value, the colors farther to each other will start to get mixed.
- sigmaColor: Value of in the coordinate space. The greater its value, the more further pixels will mix together, given that their colors lie within the sigmaColor range.
Example: Python OpenCV Bilateral Image
Python3
import cv2 # Read the image img = cv2.imread( 'geeks.png' ) # Apply bilateral filter with d = 30, # sigmaColor = sigmaSpace = 100 bilateral = cv2.bilateralFilter(img, 15 , 100 , 100 ) # Save the output cv2.imshow( 'Bilateral' , bilateral) cv2.waitKey( 0 ) cv2.destroyAllWindows() |
Output:
Getting Started with Python OpenCV
Computer Vision is one of the techniques from which we can understand images and videos and can extract information from them. It is a subset of artificial intelligence that collects information from digital images or videos.
Python OpenCV is the most popular computer vision library. By using it, one can process images and videos to identify objects, faces, or even handwriting of a human. When it is integrated with various libraries, such as NumPy, python is capable of processing the OpenCV array structure for analysis.
In this article, we will discuss Python OpenCV in detail along with some common operations like resizing, cropping, reading, saving images, etc with the help of good examples.