Another kind of Blur that can be performed using Wand library in python is Selective Blur. Selective blur is similar to normal blur. Difference is that it only effect the part of the image that have contrast below a given quantum threshold. A new attribute named as threshold is introduced in this function.
Syntax :
Python3
wand.image.selective_blur(radius=radius_value, sigma=sigma_value,                         Âthreshold=thrshold_value,                         Âchannel="optional_channel_value")Â# radius should always be greater than sigma(standard deviation)Parameters :
Parameter Input Type Description radius numbers.Real the radius of the, in pixels, not counting the center pixel. sigma numbers.Real the standard deviation, in pixels threshold number.Real Only pixels within contrast threshold are effected. Â
Image Used :Â Â
Example #1:Â Â
Python3
# import display() to show final imagefrom wand.display import displayÂ
# import Image from wand.image modulefrom wand.image import ImageÂ
# read file using Image functionwith Image(filename ="koala.jpeg") as img:Â
    # perform selective blur effect using    # selective_blur() function    img.selective_blur(radius = 8, sigma = 4,               threshold = 0.15 * img.quantum_range)Â
    # save final image    img.save(filename ="mb_koala.jpeg")Â
    # display final image    display(img) |
Output:Â
Example #2: Increase threshold value to 0.5.
Python3
# import display() to show final imagefrom wand.display import displayÂ
# import Image from wand.image modulefrom wand.image import ImageÂ
# read file using Image functionwith Image(filename ="koala.jpeg") as img:    # perform selective blur effect    # using selective_blur() function    img.selective_blur(radius = 8, sigma = 4,               threshold = 0.25 * img.quantum_range)Â
    # save final image    img.save(filename ="mb_koala.jpeg")Â
    # display final image    display(img) |
Output:Â
Â

