
- Python Pillow 教程
- Python Pillow - 首頁
- Python Pillow - 概述
- Python Pillow - 環境設定
- 基本影像操作
- Python Pillow - 影像處理
- Python Pillow - 調整影像大小
- Python Pillow - 翻轉和旋轉影像
- Python Pillow - 裁剪影像
- Python Pillow - 為影像新增邊框
- Python Pillow - 識別影像檔案
- Python Pillow - 合併影像
- Python Pillow - 剪下和貼上影像
- Python Pillow - 滾動影像
- Python Pillow - 在影像上寫文字
- Python Pillow - ImageDraw 模組
- Python Pillow - 連線兩張影像
- Python Pillow - 建立縮圖
- Python Pillow - 建立水印
- Python Pillow - 影像序列
- Python Pillow 顏色轉換
- Python Pillow - 影像上的顏色
- Python Pillow - 使用顏色建立影像
- Python Pillow - 將顏色字串轉換為 RGB 顏色值
- Python Pillow - 將顏色字串轉換為灰度值
- Python Pillow - 透過更改畫素值來更改顏色
- 影像處理
- Python Pillow - 降噪
- Python Pillow - 更改影像模式
- Python Pillow - 影像合成
- Python Pillow - 處理 Alpha 通道
- Python Pillow - 應用透視變換
- 影像濾鏡
- Python Pillow - 為影像新增濾鏡
- Python Pillow - 卷積濾鏡
- Python Pillow - 模糊影像
- Python Pillow - 邊緣檢測
- Python Pillow - 浮雕影像
- Python Pillow - 增強邊緣
- Python Pillow - 銳化蒙版濾鏡
- 影像增強和校正
- Python Pillow - 增強對比度
- Python Pillow - 增強銳度
- Python Pillow - 增強色彩
- Python Pillow - 校正色彩平衡
- Python Pillow - 去噪
- 影像分析
- Python Pillow - 提取影像元資料
- Python Pillow - 識別顏色
- 高階主題
- Python Pillow - 建立動畫 GIF
- Python Pillow - 批次處理影像
- Python Pillow - 轉換影像檔案格式
- Python Pillow - 為影像新增填充
- Python Pillow - 顏色反轉
- Python Pillow - 使用 NumPy 進行機器學習
- Python Pillow 與 Tkinter BitmapImage 和 PhotoImage 物件
- Image 模組
- Python Pillow - 影像混合
- Python Pillow 有用資源
- Python Pillow - 快速指南
- Python Pillow - 函式參考
- Python Pillow - 有用資源
- Python Pillow - 討論
Python Pillow - 增強銳度
銳度是定義照片清晰度和細節的關鍵因素,它也是強調紋理和視覺衝擊力的寶貴工具。
增強銳度是一種影像處理技術,用於增強影像的邊緣、細節和對比度,從而使其呈現更清晰、更生動的外觀。由於相機抖動、低解析度或壓縮等因素導致的模糊、噪點或失真影像,此過程可以顯著提高其質量和可見性。
增強影像銳度
在 Python Pillow 庫中,可以透過使用ImageEnhance.Sharpness()類來增強和調整影像的銳度。它允許您透過應用增強因子來調整影像的銳度。
以下是 ImageEnhance.Sharpness() 類的語法:
class PIL.ImageEnhance.Sharpness(image)
以浮點值表示的增強因子作為引數傳遞給公共的單一介面方法 enhance(factor)。此因子在調整影像銳度方面起著重要作用。使用 0.0 的因子會導致影像完全模糊,而 1.0 的因子則會提供原始影像。較高的值會增強影像的銳度。
以下是實現影像銳度增強步驟:
使用ImageEnhance.Sharpness()類建立一個銳度增強器物件。
然後使用enhance()方法將增強因子應用於增強器物件。
示例
以下示例演示如何透過指定因子來調整影像的銳度。
from PIL import Image, ImageEnhance # Open an image file image = Image.open('Images/butterfly1.jpg') # Create a Sharpness object Enhancer = ImageEnhance.Sharpness(image) # Display the original image image.show() # Enhance the sharpness with a factor of 4.0 sharpened_image = enhancer.enhance(4.0) # Display the sharpened image sharpened_image.show()
輸出
輸入影像:

輸出銳度增強後的影像:

示例
在此示例中,您可以透過將增強因子設定為接近零的值來獲得輸入影像的模糊版本。
from PIL import Image, ImageEnhance # Open an image file image = Image.open('Images/butterfly.jpg') # Create a Sharpness object enhancer = ImageEnhance.Sharpness(image) # Display the original image image.show() # Decrease the sharpness by using a factor of 0.05 sharpened_image = enhancer.enhance(0.05) # Display the sharpened image sharpened_image.show()
輸出
輸入影像:

輸出輸入影像的模糊版本:

廣告