Skip to content

Commit 5ce5f70

Browse files
committed
[panorama] added shift option
1 parent 54ecbbc commit 5ce5f70

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/instrumentman/panorama/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@ def cli_measure(**kwargs: Any) -> None:
174174
help="Axis-aligned camera offset from the instrument center",
175175
type=(float, float, float)
176176
)
177+
@option(
178+
"--shift",
179+
help=(
180+
"Shift bearing of panorama center to reorient view and potentially "
181+
"remove black gaps (only exact for strip and sphere)"
182+
),
183+
type=Angle()
184+
)
177185
@option(
178186
"--compensation",
179187
help="Basic exposure compensation method",

src/instrumentman/panorama/process.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ def run_annotate(
163163
meta: PanoramaMetadata,
164164
output: Path,
165165
images: dict[str, Path],
166+
shift: Angle,
166167
scale: float | None = None,
167168
points: list[tuple[str, Coordinate, str]] = [],
168169
camera_offset: Coordinate | None = None,
@@ -218,6 +219,7 @@ def run_annotate(
218219
continue
219220

220221
hz, v, _ = vec.to_polar()
222+
hz = (hz - shift).normalized()
221223
height: int
222224
width: int
223225
height, width, _ = img.shape
@@ -350,14 +352,16 @@ def run_annotate(
350352
# is rotated with the preliminary angles.
351353
prelim_hz, prelim_v, _ = (coord - center).to_polar()
352354
offset_rot = (
353-
rot_z(float(prelim_hz))
355+
rot_z(float((prelim_hz - shift).normalized()))
354356
@ rot_x(np.pi / 2 - float(prelim_v))
355357
)
356358
pt_hz, pt_v, _ = (
357359
coord
358360
- (center + apply_rotation(camera_offset, offset_rot))
359361
).to_polar()
360362

363+
pt_hz = (pt_hz - shift).normalized()
364+
361365
pt_hz_f = float(pt_hz - tl_hz)
362366
pt_v_f = float(pt_v - tl_v)
363367
pt_x = round(tl_x + pt_hz_f * scale) % full_360
@@ -468,6 +472,7 @@ def main(
468472
output: Path,
469473
image: tuple[Path],
470474
camera_offset: tuple[float, float, float] | None = None,
475+
shift: str | None = None,
471476
compensation: str = "channel",
472477
blending: str = "multiband",
473478
scale: float | None = None,
@@ -559,6 +564,7 @@ def main(
559564
meta,
560565
output,
561566
image_map,
567+
Angle.from_dms(shift) if shift is not None else Angle(0),
562568
scale,
563569
points,
564570
cam_offset,

0 commit comments

Comments
 (0)