From 42e2264f06c05995a25bccb84b2999077c3c7746 Mon Sep 17 00:00:00 2001 From: ykcheungab Date: Wed, 1 Jul 2026 21:53:04 +0800 Subject: [PATCH] fix dd01 slow stitching due to disabled numba --- src/orisys/Stitcher.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/orisys/Stitcher.py b/src/orisys/Stitcher.py index f76c925..b4d1068 100644 --- a/src/orisys/Stitcher.py +++ b/src/orisys/Stitcher.py @@ -3,9 +3,22 @@ import numpy as np import scipy.fft from scipy import ndimage import cv2 -# from numba import njit -# @njit(cache=False) +try: + from numba import njit + + _NUMBA_AVAILABLE = True +except ImportError: + _NUMBA_AVAILABLE = False + + def njit(*args, **kwargs): + def decorator(fn): + return fn + + return decorator + + +@njit(cache=False) def _blend_kernel(blend_patch, wsum_patch, cov_patch, src_patch, w_patch): """Fused incremental weighted-average composite (numba-accelerated).""" sh = src_patch.shape[0] @@ -73,6 +86,12 @@ class Stitcher: self._feature_stitch_pad = 5 self._feature_stitch_match_brightness = False + if self.isstitch and not _NUMBA_AVAILABLE: + print( + "Warning: numba is not installed; feature stitching will run a slow " + "Python blend path (~1 FPS). Install numba for real-time performance." + ) + if self.verbose: print(f"Stitcher initialized with config: {self.config_stitcher}") -- 2.52.0