Testing with uint conversion

This commit is contained in:
2025-12-19 13:10:36 +02:00
parent 2b0b48921e
commit 5d25378c46
2 changed files with 5 additions and 3 deletions

View File

@@ -54,7 +54,8 @@ def apply_ultralytics_16bit_tiff_patches(*, force: bool = False) -> None:
- For other formats, falls back to Ultralytics' original implementation.
- Always returns HWC (3 dims). For grayscale, returns (H, W, 1) or (H, W, 3) depending on requested flags.
"""
# print("here")
# return _original_imread(filename, flags)
ext = os.path.splitext(filename)[1].lower()
if ext in (".tif", ".tiff"):
arr = Image(filename).get_qt_rgb()[:, :, :3]
@@ -75,6 +76,7 @@ def apply_ultralytics_16bit_tiff_patches(*, force: bool = False) -> None:
# Ensure contiguous array for downstream OpenCV ops.
# logger.info(f"Loading with monkey-patched imread: {filename}")
arr *= (2**16 - 1).astype(np.uint16)
return np.ascontiguousarray(arr)
# logger.info(f"Loading with original imread: {filename}")