Closed joe1chief closed 6 years ago
By default, the deformation is applied to every dimension of the input. So in your RGB image, there's also a deformation between the colour channels. That looks odd.
I've pushed an update that adds an axis
parameter that you can use to specify the axes that you want to deform. For your example, that would look like this:
X = imageio.imread('testgrid.jpg')
X_deformed = elasticdeform.deform_random_grid(X.astype('float64'),
sigma=25, points=3, axis=(0, 1))
imageio.imsave('test_X.png', X)
imageio.imsave('test_X_deformed.png', X_deformed.clip(0, 255).astype('uint8'))
It might be useful to convert the image to a float before computing the deformation, since the uint8 will give you strange rounding and overflow errors. If you do the interpolation in floats the result looks much better:
Thanks a lot!
Run following codes on the above image, I get an odd result.