updated the processing part, fixed the orientation of the images