Skip to content

Commit 13dce23

Browse files
author
arch
committed
make menu more responsive
1 parent 640f359 commit 13dce23

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

funscript_editor/algorithms/funscriptgenerator.py

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -443,38 +443,42 @@ def get_perspective_roi(self, image :np.ndarray) -> None:
443443
if image.shape[0] > 3000 or image.shape[1] > 3000:
444444
image = cv2.resize(image, None, fx=0.5, fy=0.5)
445445

446-
selected = False
446+
parameter_changed, selected = True, False
447447
while not selected:
448-
preview = EquirectangularVideoStream.get_perspective(
449-
image,
450-
perspective['FOV'],
451-
perspective['THETA'],
452-
perspective['PHI'],
453-
perspective['height'],
454-
perspective['width']
455-
)
456-
457-
preview = self.drawText(preview, "Press 'q' to use current selected region of interest)",
458-
y = 50, color = (255, 0, 0))
459-
preview = self.drawText(preview, "Use 'w', 's' to move up/down to the region of interest",
460-
y = 75, color = (0, 255, 0))
448+
if parameter_changed:
449+
parameter_changed = False
450+
preview = EquirectangularVideoStream.get_perspective(
451+
image,
452+
perspective['FOV'],
453+
perspective['THETA'],
454+
perspective['PHI'],
455+
perspective['height'],
456+
perspective['width']
457+
)
458+
459+
preview = self.drawText(preview, "Press 'q' to use current selected region of interest)",
460+
y = 50, color = (255, 0, 0))
461+
preview = self.drawText(preview, "Use 'w', 's' to move up/down to the region of interest",
462+
y = 75, color = (0, 255, 0))
461463

462464
cv2.imshow(self.window_name, preview)
463465
while self.keypress_queue.qsize() > 0:
464466
pressed_key = '{0}'.format(self.keypress_queue.get())
465467
if pressed_key == "'q'":
466468
selected = True
469+
break
467470
elif pressed_key == "'w'":
468471
perspective['PHI'] = min((80, perspective['PHI'] + 5))
472+
parameter_changed = True
469473
elif pressed_key == "'s'":
470474
perspective['PHI'] = max((-80, perspective['PHI'] - 5))
475+
parameter_changed = True
471476
# elif pressed_key == "'a'":
472477
# perspective['THETA'] -= 5
473478
# elif pressed_key == "'d'":
474479
# perspective['THETA'] += 5
475480

476-
if cv2.waitKey(1) in [ord('q')]:
477-
selected = True
481+
if cv2.waitKey(1) in [ord('q')]: break
478482

479483
self.perspective_params = perspective
480484

funscript_editor/config/hyperparameter.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ bottom_points_offset: -15.0
3131

3232
# Define the top threshold. All top points greater than (max - threshold) will be set to
3333
# the specified max value. Set 0.0 to disable this function.
34-
top_threshold: 5.0
34+
top_threshold: 2.5
3535

3636
# Define the bottom threshold. All bottom points lower than (min + threshold) will be set to
3737
# the specified min value. Set 0.0 to disable this function.
38-
bottom_threshold: 5.0
38+
bottom_threshold: 2.5

0 commit comments

Comments
 (0)