Handle multi-channel images with the axis parameter
masterBy default, deformation is applied to every dimension. For multi-channel images (e.g., RGB), use the axis parameter to specify which axes should be deformed. The same deformation is applied across all channels.
When deforming multiple inputs, axis can accept a list of tuples, allowing different axis specifications for each input.
# Deform an RGB image across the first two dimensions
X_deformed = elasticdeform.deform_random_grid(X, axis=(0, 1))
# Deform multiple inputs with different axis configurations
X = numpy.random.rand(3, 200, 300)
Y = numpy.random.rand(200, 300)
[X_deformed, Y_deformed] = elasticdeform.deform_random_grid([X, Y], axis=[(1, 2), (0, 1)])