def saveimage(filename, im):
 if (len(im.shape) == 3):
  cv2.imwrite(filename, (255 * im[:, :, ::(-1)]))
 else:
  cv2.imwrite(filename, (255 * im))

def saveimage ( filename , im ) : if ( len ( im . shape ) == 3 ) : cv2 . imwrite ( filename , ( 255 * im [ : , : , : : ( - 1 ) ] ) ) else : cv2 . imwrite ( filename , ( 255 * im ) )
saves an image with pixel values in [0 .