Skip to content

Commit ddee6ae

Browse files
committed
[panorama] reworked stitch visualization
1 parent 214d019 commit ddee6ae

File tree

1 file changed

+36
-8
lines changed

1 file changed

+36
-8
lines changed

src/instrumentman/panorama/process.py

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,14 @@ def run_processing(
246246
height: int
247247
width: int
248248
height, width, _ = img.shape
249+
mask = np.full((height, width), 255, np.uint8)
250+
251+
if scale is None:
252+
scale = focal
253+
scale = min(scale, _MAX_SCALE)
254+
255+
if warper is None:
256+
warper = cv.PyRotationWarper("spherical", scale)
249257

250258
if visualize_stitch:
251259
img = np.stack(
@@ -268,13 +276,33 @@ def run_processing(
268276
),
269277
axis=2
270278
)
271-
272-
if warper is None:
273-
if scale is None:
274-
scale = focal
275-
276-
scale = min(scale, _MAX_SCALE)
277-
warper = cv.PyRotationWarper("spherical", scale)
279+
mask = np.full((height, width), 0, np.uint8)
280+
cv.rectangle(
281+
mask,
282+
(0, 0),
283+
(width, height),
284+
(255,),
285+
50
286+
)
287+
scaler = focal / scale
288+
cv.putText(
289+
mask,
290+
data["filename"],
291+
text_pos(
292+
data["filename"],
293+
(round(width/2), round(height/2)),
294+
(0.0, 0.0),
295+
font,
296+
fontscale * scaler,
297+
round(thickness * scaler),
298+
"mc"
299+
),
300+
font,
301+
fontscale * scaler,
302+
(255,),
303+
round(thickness * scaler),
304+
bottomLeftOrigin=False
305+
)
278306

279307
rot: npt.NDArray[np.float32] = (
280308
rot_y(float(hz))
@@ -294,7 +322,7 @@ def run_processing(
294322

295323
mask_warped: npt.NDArray[np.uint8]
296324
_, mask_warped = warper.warp( # type: ignore[assignment]
297-
np.full((height, width), 255, np.uint8),
325+
mask,
298326
instrinsics,
299327
rot,
300328
cv.INTER_NEAREST,

0 commit comments

Comments
 (0)