From c5bf2aadbbe15e4f7b33a25460d12fea52482bf5 Mon Sep 17 00:00:00 2001 From: Emyr Thomas Date: Thu, 21 Jul 2022 17:10:00 +0100 Subject: [PATCH] Fix map image positions to prevent out of bounds error when using pyvips mapim --- src/kubi/kubi.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/kubi/kubi.py b/src/kubi/kubi.py index 6a582bf..4cd3e99 100644 --- a/src/kubi/kubi.py +++ b/src/kubi/kubi.py @@ -61,7 +61,9 @@ def kubi(args): ### TODO replace numpy with vips - ls = np.linspace(-1, 1, size, dtype="f4", endpoint=False) + ls, step = np.linspace(-1, 1, size, dtype="f4", endpoint=False, retstep=True) + view = ls.reshape(1, size) + view += step/2 if args.transform == "eac": # C.Brown (2017): Bringing pixels front and center in VR video ls = np.tan(ls / (4 / pi)) @@ -75,7 +77,7 @@ def kubi(args): x1 = np.arctan2(xv, yv) y1 = np.arctan(np.hypot(yv,xv)) - ls = xv = yv = None + ls = view = xv = yv = None piot = pi/2