April 2020
Intermediate to advanced
438 pages
12h 2m
English
For this recipe, we will be using the bilateralFilter() function from OpenCV-Python. We need to start by downsampling the image to create an image pyramid (you will see more of this in the next chapter), followed by repeated application of small bilateral filters (to remove unimportant details) and upsampling the image to its original size. Next, you need to apply the median blur (to flatten the texture) followed by masking the original image with the binary image obtained by adaptive thresholding. The following code demonstrates the steps:
img = plt.imread("images/bean.png")num_down = 2 # number of downsampling stepsnum_bilateral = 7 # number of bilateral ...Read now
Unlock full access