Preprocessed changing image to grayscale that took place at every iteration redundantly