albumentations-team / albumentations

Fast and flexible image augmentation library. Paper about the library: https://www.mdpi.com/2078-2489/11/2/125
https://albumentations.ai
MIT License
14.26k stars 1.65k forks source link

Float input values for RandomGamma #1286

Closed zahragolpa closed 2 years ago

zahragolpa commented 2 years ago

🐛 Bug

I get an error when I run RandomGamma transform with a float gamma_limit value.

To Reproduce

Steps to reproduce the behavior:

  1. Run RandomGamma with a float gamma_limit value.
import albumentations as A
import cv2

input_image_numpy = cv2.imread(PATH_TO_INPUT_IMAGE)
transform = A.Compose([A.RandomGamma(gamma_limit=(80.8, 120.2), p=1)])
transformed = transform(image=input_image_numpy)
transformed_image = transformed["image"]
cv2.imwrite('output.png', transformed_image)

The error I get:

ValueError: non-integer arg 1 for randrange()

Expected behavior

Should produce the output image even when input is float, as stated in the documentation.

Environment

Dipet commented 2 years ago

Fixed in #1287