通過隨機因子調整圖像的對比度。
用法
tf.image.random_contrast(
image, lower, upper, seed=None
)參數
-
image具有 3 個或更多維度的圖像張量。 -
lower浮點數。隨機對比度因子的下限。 -
upper浮點數。隨機對比度因子的上限。 -
seed一個 Python 整數。用於創建隨機種子。有關行為,請參見tf.compat.v1.set_random_seed。
返回
- contrast-adjusted 圖像。
拋出
-
ValueError如果upper <= lower或lower < 0。
等效於 adjust_contrast() 但使用在區間 [lower, upper) 中隨機選取的 contrast_factor 。
要在給定 seed 值的情況下生成確定性結果,請使用 tf.image.stateless_random_contrast 。與使用seed 參數和tf.image.random_* ops 不同,tf.image.stateless_random_* ops 保證相同的結果給定相同的種子,而與調用函數的次數無關,並且與全局種子設置無關(例如 tf.random.set_seed )。
使用示例:
x = [[[1.0, 2.0, 3.0],
[4.0, 5.0, 6.0]],
[[7.0, 8.0, 9.0],
[10.0, 11.0, 12.0]]]
tf.image.random_contrast(x, 0.2, 0.5)
<tf.Tensor:shape=(2, 2, 3), dtype=float32, numpy=...>
相關用法
- Python tf.image.random_crop用法及代碼示例
- Python tf.image.random_brightness用法及代碼示例
- Python tf.image.random_hue用法及代碼示例
- Python tf.image.random_saturation用法及代碼示例
- Python tf.image.random_jpeg_quality用法及代碼示例
- Python tf.image.random_flip_up_down用法及代碼示例
- Python tf.image.random_flip_left_right用法及代碼示例
- Python tf.image.rot90用法及代碼示例
- Python tf.image.rgb_to_yiq用法及代碼示例
- Python tf.image.resize_with_crop_or_pad用法及代碼示例
- Python tf.image.resize用法及代碼示例
- Python tf.image.rgb_to_hsv用法及代碼示例
- Python tf.image.rgb_to_grayscale用法及代碼示例
- Python tf.image.pad_to_bounding_box用法及代碼示例
- Python tf.image.adjust_hue用法及代碼示例
- Python tf.image.flip_left_right用法及代碼示例
- Python tf.image.convert_image_dtype用法及代碼示例
- Python tf.image.stateless_random_flip_up_down用法及代碼示例
- Python tf.image.extract_glimpse用法及代碼示例
- Python tf.image.flip_up_down用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.image.random_contrast。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
