當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python Wand adaptive_blur()用法及代碼示例

adaptive_blur()函數是Python Wand ImageMagick庫中的內置函數,該函數用於通過減小高斯值作為運算符來模糊圖像。它存在於wand.image類中。

用法:
adaptive_blur(radius, sigma, channel)

參數:該函數接受上麵提到的和下麵定義的三個參數:

  • radius:此參數用於指定半徑值,即高斯光圈的大小。
  • sigma:此參數用於指定sigma的值,它是高斯濾波器的標準偏差。
  • channel:此參數用於將圖像通道的值指定為未定義的‘red’, ‘gray’,‘cyan’, ‘green’,‘magenta’, ‘blue’,‘yellow’, ‘alpha’,‘opacity’, ‘black’,‘index’, ‘composite_channels’,‘all_channels,‘sync_channels’, ‘default_channels’。

返回值:此函數返回Wand ImageMagick對象。

原始圖片:



範例1:

# Import library from Image  
from wand.image import Image 
  
# Import the image 
with Image(filename ='../geeksforgeeks.png') as image:
    # Clone the image in order to process 
    with image.clone() as adaptive_blur:
        # Invoke adaptive_blur function with radius as 2, sigma as  
        # 3 and channel as Green 
        adaptive_blur.adaptive_blur(0, 3, 'Green') 
        # Save the image 
        adaptive_blur.save(filename ='adaptive_blur1.jpg')

輸出:

範例2:

# Import library from Image  
from wand.image import Image 
  
# Import the image 
with Image(filename ='../geeksforgeeks.png') as image:
  
    # Clone the image in order to process 
    with image.clone() as adaptive_blur:
        # Invoke adaptive_blur function with radius as 2, sigma as  
        # 3 and channel as Green 
        adaptive_blur.adaptive_blur(int(0), int(3), 'Green') 
  
        # Save the image 
        adaptive_blur.save(filename ='adaptive_blur1.jpg')

輸出:




相關用法


注:本文由純淨天空篩選整理自sarthak_ishu11大神的英文原創作品 Wand adaptive_blur() function – Python。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。