Utilities related to images¶
Converter¶
-
researchutils.image.converter.chw2hwc(image)[source]¶ Changes the order of image pixels from Color-Height-Width to Height-Width-Color
Parameters: image (numpy.ndarray) – Image with pixels in Color-Height-Width order Returns: image – Image with pixels in Height-Width-Color order Return type: numpy.ndarray
-
researchutils.image.converter.hwc2chw(image)[source]¶ Changes the order of image pixels from Height-Width-Color to Color-Height-Width
Parameters: image (numpy.ndarray) – Image with pixels in Height-Width-Color order Returns: image – Image with pixels in Color-Height-Width order Return type: numpy.ndarray
Preprocess¶
Viewer¶
-
researchutils.image.viewer.animate(images, comparisons=None, titles=[], is_gray=False, fps=15, repeat=False, save_gif=False, save_mp4=False, auto_close=False)[source]¶ Animate list of images
Parameters: - images (list of numpy.ndarray) – Images to display
- comparisons (list of numpy.ndarray) – Comparison images or multiple list of comparison images to display (Optional)
- titles (list of string) – Titles for each animation
- is_gray (bool) – Whether given images are grayscale or colored True if images are grayscale
- fps (int) – Number of frames to display in 1 second. Abbreviation of “frame per second”
- repeat (bool) – Repeat animation when reaches end of images
- save_gif (bool) – Save animation as gif image
- save_mp4 (bool) – Save animation as mp4
- auto_close (bool) – Close animation window after finish animating
-
researchutils.image.viewer.animate_in_matrix_form(images=None, titles=[], is_gray=False, fps=15, images_per_row=None, repeat=False, save_gif=False, save_mp4=False, auto_close=False)[source]¶ Animate list of images in matrix form
Parameters: - images (list of numpy.ndarray) – Images to display
- titles (list of string) – Titles for each animation
- is_gray (bool) – Whether given images are grayscale or colored True if images are grayscale
- fps (int) – Number of frames to display in 1 second. Abbreviation of “frame per second”
- images_per_row (int) – Number of images to display in each row
- repeat (bool) – Repeat animation when reaches end of images
- save_gif (bool) – Save animation as gif image
- save_mp4 (bool) – Save animation as mp4
- auto_close (bool) – Close animation window after finish animating
-
researchutils.image.viewer.show_image(image, title='', is_gray=False)[source]¶ Display given image
Parameters: - image (numpy.ndarray) – Image to display
- title (string) – Title of the image to display
- is_gray (bool) – Whether given image is grayscale or colored True if image is grayscale
-
researchutils.image.viewer.show_images(images, title='', comparisons=None, comparison_title='', is_gray=False, vertical=False)[source]¶ Display given image
Parameters: - images (list of numpy.ndarray) – Images to display
- title (string) – Title of each image to display. If length of images is greater than 1, index of each image will be appended to the tail of title.
- comaprisons (list of numpy.ndarray) – Comparison images to display
- comaprison_title (list of numpy.ndarray) – Title of each comparison image to display. If length of comparisons is greater than 1, index of each image will be appended to the tail of title.
- is_gray (bool) – Whether given images are grayscale or colored True if images are grayscale
- vertical (bool) – Display comparisons vertically