interpolation more robust if only nans in keypoint coords

This commit is contained in:
David PAGNON 2024-08-28 01:00:15 +02:00 committed by GitHub
parent 90a7b86113
commit 75cbd8376b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -92,6 +92,9 @@ def interpolate_zeros_nans(col, *args):
# Interpolate nans
mask = ~(np.isnan(col) | col.eq(0)) # true where nans or zeros
idx_good = np.where(mask)[0]
if len(idx_good) <= 4:
return col
if 'kind' not in locals(): # 'linear', 'slinear', 'quadratic', 'cubic'
f_interp = interpolate.interp1d(idx_good, col[idx_good], kind="linear", bounds_error=False)
else: