def slide_to_scaled_np_image(slide_number): """ Convert a WSI training slide to a scaled-down NumPy image. Args: slide_number: The slide number. Returns: Tuple consisting of scaled-down NumPy image, original width, original height, new width, and new height. """ pil_img, large_w, large_h, new_w, new_h = slide_to_scaled_pil_image(slide_number) np_img = util.pil_to_np_rgb(pil_img) return np_img, large_w, large_h, new_w, new_h
def open_image_np(filename): """ Open an image (*.jpg, *.png, etc) as an RGB NumPy array. Args: filename: Name of the image file. returns: A NumPy representing an RGB image. """ pil_img = open_image(filename) np_img = util.pil_to_np_rgb(pil_img) return np_img