When I rotate an image using imgaug, the space around the original image is black. Is there any way to randomize the color instead?
Currently I'm trying to do this by switching from RGB to HSV, but the images get saved in a weird tint. I would prefer to keep the original color of the image, and just change the background color.
# iaa.Crop(percent=(0, 0.1)), #Random cropping between 0% and 10% of the image size.
iaa.Fliplr(0.1), #Random horizontal flipping with a probability of 50%.
iaa.Affine(rotate=(-180, 180)),
iaa.Affine(translate_percent={"x": (-0.1, 0.1), "y": (-0.1, 0.1)}), #Random translation between -10% and 10% of the image size.
iaa.Sometimes(0.5, iaa.Affine(shear={"y": (-45, 45)})),
iaa.Add((-10, 10), per_channel=0.5), #Random brightness adjustment between -10 and 10.
iaa.Multiply((0.9, 1.1), per_channel=0.5), #Random contrast adjustment between 0.9 and 1.1.
iaa.ContrastNormalization((0.9, 1.1), per_channel=0.5), #Random saturation adjustment between 0.9 and 1.1.
iaa.WithColorspace(to_colorspace="HSV", from_colorspace="RGB", children=iaa.Add((0, 50), per_channel=True)),
iaa.WithColorspace(to_colorspace="RGB", from_colorspace="HSV", children=iaa.WithChannels(0, iaa.Noop())),
iaa.Sometimes(0.5, iaa.GaussianBlur(sigma=(0, 0.5))), #Random Gaussian blur with a sigma between 0 and 0.5.
iaa.Sometimes(0.5, iaa.Dropout(p=(0, 0.1))), #Random dropout with a probability between 0 and 0.1.
iaa.Sometimes(0.5, iaa.CoarseDropout(p=(0, 0.1), size_percent=(0.02, 0.05))), #Random coarse dropout with a probability between 0 and 0.1 and a size between 2% and 5% of the image size.
iaa.Sometimes(0.5, iaa.PiecewiseAffine(scale=(0.01, 0.05))), #Random piecewise affine transformation with a scale between 0.01 and 0.05.
iaa.Sometimes(0.5, iaa.PerspectiveTransform(scale=(0.01, 0.1))), #Random perspective transformation with a scale between 0.01 and 0.1.
iaa.Sometimes(0.5, iaa.AdditiveGaussianNoise(scale=(0, 0.05*255))), #Random Gaussian noise with a scale between 0 and 0.05 times the maximum pixel value.
iaa.Sometimes(0.5, iaa.GammaContrast((0.5, 2.0))), #Random gamma contrast adjustment between 0.5 and 2.0.
iaa.Sometimes(0.5, iaa.MotionBlur(k=(3, 7))) #Random motion blur with a kernel size between 3 and 7.
])```