Skip to content

Commit e5c7937

Browse files
author
arch
committed
visu for roll
1 parent 3fc44ed commit e5c7937

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

funscript_editor/algorithms/funscriptgenerator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,10 @@ def scale_score(self, status: str, metric : str = 'y') -> None:
274274
max_tracking_points = self.get_tracking_points_by_frame_number(max_frame - self.params.start_frame)
275275

276276
for points in min_tracking_points:
277-
imgMin = OpenCV_GUI.draw_point_to_image(imgMin, points)
277+
imgMin = OpenCV_GUI.draw_point_to_image(imgMin, points, connect_points=(metric == 'roll'))
278278

279279
for points in max_tracking_points:
280-
imgMax = OpenCV_GUI.draw_point_to_image(imgMax, points)
280+
imgMax = OpenCV_GUI.draw_point_to_image(imgMax, points, connect_points=(metric == 'roll'))
281281

282282
# print('min_tracking_points', min_tracking_points, 'max_tracking_points', max_tracking_points)
283283

funscript_editor/ui/opencvui.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,19 @@ def draw_box_to_image(image: np.ndarray, bbox, color: tuple = (255, 0, 255)) ->
260260

261261

262262
@staticmethod
263-
def draw_point_to_image(image: np.ndarray, point, color: tuple = (255, 0, 255)) -> np.ndarray:
263+
def draw_point_to_image(
264+
image: np.ndarray,
265+
point,
266+
color: tuple = (255, 0, 255),
267+
connect_points: bool = False
268+
) -> np.ndarray:
264269
""" Draw an point to given image
265270
266271
Args:
267272
image (np.ndarray): image
268273
point (tuple or list): points (x,y) or list of points
269274
color (tuple): RGB color values for the box
275+
connect_points (bool): connect points with an line
270276
271277
Returns:
272278
np.ndarray: opencv image
@@ -283,6 +289,15 @@ def draw_point_to_image(image: np.ndarray, point, color: tuple = (255, 0, 255))
283289
2
284290
)
285291

292+
if len(point) > 1 and connect_points:
293+
for i in range(len(point)-1):
294+
cv2.line(
295+
image,
296+
point[i],
297+
point[i+1],
298+
color,
299+
2)
300+
286301
return image
287302

288303

0 commit comments

Comments
 (0)