You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This pull request introduces improvements and optimizations to the image loading and saving functions in the code. The main goal is to make the code cleaner, more maintainable, and more efficient.
Changes Made:
Refactored default_image_loader:
Ensured that default_image_loader correctly handles the selection of either the jpeg4py_loader or opencv_loader without redundant code.
Improved error handling for image loading failures.
Added a failsafe in jpeg4py_loader_w_failsafe:
If jpeg4py fails to load an image, the function now reverts to opencv_loader as a fallback.
More robust error handling to ensure that an image is always loaded or a clear error message is shown.
Optimized opencv_loader:
Streamlined error handling and ensured that OpenCV's image loading is more reliable.
Improved Segmentation Loader (opencv_seg_loader):
Refined the opencv_seg_loader to ensure consistent error handling and better messages for segmentation-specific image loading.
Refined imread_indexed and imwrite_indexed:
The code now handles indexed image reading and saving more cleanly, ensuring that segmentation annotations are correctly processed and saved in a more user-friendly way.
Added the color_palette parameter to imwrite_indexed to allow for custom color palettes for indexed images.
Ensured that imwrite_indexed properly handles saving 2D arrays as indexed PNGs with color palettes.
Motivation
These changes help streamline the image processing and loading workflow. By improving the code structure, error handling, and fallback mechanisms, this PR enhances the tool’s reliability and readability, making it more maintainable and easier to extend in the future.
The text was updated successfully, but these errors were encountered:
Overview
This pull request introduces improvements and optimizations to the image loading and saving functions in the code. The main goal is to make the code cleaner, more maintainable, and more efficient.
Changes Made:
Refactored
default_image_loader
:default_image_loader
correctly handles the selection of either thejpeg4py_loader
oropencv_loader
without redundant code.Added a failsafe in
jpeg4py_loader_w_failsafe
:jpeg4py
fails to load an image, the function now reverts toopencv_loader
as a fallback.Optimized
opencv_loader
:Improved Segmentation Loader (
opencv_seg_loader
):opencv_seg_loader
to ensure consistent error handling and better messages for segmentation-specific image loading.Refined
imread_indexed
andimwrite_indexed
:color_palette
parameter toimwrite_indexed
to allow for custom color palettes for indexed images.imwrite_indexed
properly handles saving 2D arrays as indexed PNGs with color palettes.Motivation
These changes help streamline the image processing and loading workflow. By improving the code structure, error handling, and fallback mechanisms, this PR enhances the tool’s reliability and readability, making it more maintainable and easier to extend in the future.
The text was updated successfully, but these errors were encountered: