pankaj Kang
pankaj Kang

Reputation: 131

Keras ImageDataGenerator apply_transform() method shifts the image in opposite direction

When I try to implement Keras ImageDataGenerator apply_transform method to shift the image in the horizontal direction, the image is translated in the opposite direction.

I've seen its source code but not sure why implementation is like this. Below is the code

datagen = ImageDataGenerator()
translate = datagen.apply_transform(x=img, transform_parameters={'ty':20})

Output:

enter image description here

Upvotes: 2

Views: 1254

Answers (1)

Ioannis Nasios
Ioannis Nasios

Reputation: 8527

try -20 instead of 20

datagen = ImageDataGenerator()
translate = datagen.apply_transform(x=img, transform_parameters={'ty':-20})

Upvotes: 2

Related Questions