在evaluate()函數中,可以通過應用算術,關係或邏輯表達式來操縱像素通道。
用法:
wand.image.evaluate(operator, value, channel)
參數:
| 參數 | 輸入類型 | 描述 |
|---|---|---|
| operator | basestring | 要計算的操作類型。 |
| value | numbers.Real | 要計算的數字 |
| channel | basestring | 用於對其進行操作的可選渠道。 |
以下是Wand中的EVALUATE_OPS列表:
| EVALUATE_OPS | 描述 |
|---|---|
| ‘undefined’ | 它是默認值EVALUATE_OPS。 |
| ‘abs’ | 創建一個抽象評估。 |
| ‘add’ | 添加評估。 |
| ‘addmodulus’ | 添加模量評估。 |
| ‘and’ | 和評估。 |
| ‘cosine’ | 從餘弦函數求值。 |
| ‘gaussiannoise’ | 添加高斯噪聲評估 |
| ‘impulsenoise’ | 添加脈衝噪聲評估 |
| ‘laplaciannoise’ | 添加拉普拉斯噪聲評估 |
| ‘leftshift’ | 按位左移 |
| ‘max’ | 最高評價 |
| ‘mean’ | 添加了均值評估。 |
| ‘median’ | 添加了中位數評估。 |
| ‘multiplicativenoise’ | 添加乘法噪聲評估 |
| ‘multiply’ | 倍增圖像評估 |
| ‘or’ | 或評估 |
| ‘poissonnoise’ | 添加泊鬆噪聲評估 |
| ‘pow’ | 添加電源評估 |
| ‘rightshift’ | 按位右移 |
| ‘set’ | 添加集合評估 |
| ‘sine’ | 添加正弦函數評估 |
| ‘threshold’ | 添加具有特定閾值點的閾值評估。 |
| ‘thresholdblack’ | 閾值為黑色時添加評估。 |
| ‘thresholdwhite’ | 閾值為白色時添加評估。 |
| ‘uniformnoise’ | 添加統一的噪聲評估 |
源圖像:

代碼示例1:
# Import Image from wand.image module
from wand.image import Image
# Read image using Image function
with Image(filename ="koala.jpeg") as img:
img.evaluate(operator ='rightshift', value = 1, channel ='blue')
img.save(filename ="kl-enhanced.jpeg")輸出圖像:

代碼示例2:
# Import Image from wand.image module
from wand.image import Image
# Read image using Image function
with Image(filename ="koala.jpeg") as img:
img.evaluate(operator ='leftshift', value = 1, channel ='red')
img.save(filename ="kl-enhanced2.jpeg")輸出圖像:

相關用法
- Python Wand function()用法及代碼示例
- Python Wand gaussian_blur()用法及代碼示例
- Python Wand transform()用法及代碼示例
- Python Wand crop()用法及代碼示例
- Python Wand rotational_blur()用法及代碼示例
- Python Wand Image()用法及代碼示例
- Python Wand shade()用法及代碼示例
- Python Wand sharpen()用法及代碼示例
- Python Wand adaptive_sharpen()用法及代碼示例
- Python Wand noise()用法及代碼示例
- Python Wand blue_shift()用法及代碼示例
- Python Wand color_matrix()用法及代碼示例
- Python Wand unsharp_mask()用法及代碼示例
- Python Wand colorize()用法及代碼示例
- Python Wand fx()用法及代碼示例
- Python Wand implode()用法及代碼示例
注:本文由純淨天空篩選整理自RahulSabharwal大神的英文原創作品 Python – evaluate() function in Wand。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
