I have a large dataset of RGB images with 220x220x3. I want to crop the region of interest from each of them. For that, I have defined my own function. Im trying to use this with DataImageGenerators but it's only resizing rather than cropping.
def crop(image): x=0 h=110 print(image.shape) return image[x:x+h,:,:] IMAGES_DIR1='/home/imtiaz/Desktop/Medium/Article1/Image_preprocessing/All towns/All' test_datagen = ImageDataGenerator(rescale = 1./255, preprocessing_function=crop) test_generator = test_datagen.flow_from_dataframe( dataframe=df_test, directory=IMAGES_DIR1, x_col="Images", y_col="steer", target_size=(110, 220), class_mode='other')
And when I check those images using
from keras.preprocessing.image import array_to_img array_to_img(x)
When I display the image it isn't the cropped one. What am I doing wrong ?