added mesh surface arrows
This commit is contained in:
@@ -5,7 +5,7 @@ from __future__ import annotations
|
||||
import cv2
|
||||
|
||||
from pipeline.frame import FingerFrameView
|
||||
from viz.render_2d import render_uv_arrows
|
||||
from viz.render_2d import ArrowBackground, ArrowCanvasColors, render_uv_arrows
|
||||
|
||||
from ..layout import DashboardLayout, LAYOUT
|
||||
from .image_panel import ImagePanel
|
||||
@@ -19,6 +19,8 @@ class ArrowPanelWidget(ImagePanel):
|
||||
self,
|
||||
*,
|
||||
flow_threshold: float = 0.5,
|
||||
background: ArrowBackground = "unrolled",
|
||||
canvas_colors: ArrowCanvasColors | None = None,
|
||||
layout: DashboardLayout = LAYOUT,
|
||||
parent=None,
|
||||
):
|
||||
@@ -30,15 +32,18 @@ class ArrowPanelWidget(ImagePanel):
|
||||
parent=parent,
|
||||
)
|
||||
self.flow_threshold = flow_threshold
|
||||
self.background = background
|
||||
self.canvas_colors = canvas_colors if canvas_colors is not None else layout.arrow_canvas_colors
|
||||
|
||||
def set_flow_threshold(self, threshold: float) -> None:
|
||||
self.flow_threshold = threshold
|
||||
|
||||
def update_frame(self, frame: FingerFrameView) -> None:
|
||||
arrows = render_uv_arrows(
|
||||
frame.unrolled,
|
||||
frame.vnormal,
|
||||
frame,
|
||||
flow_threshold=self.flow_threshold,
|
||||
background=self.background,
|
||||
canvas_colors=self.canvas_colors,
|
||||
)
|
||||
arrows = cv2.rotate(arrows, cv2.ROTATE_180)
|
||||
self.set_source_pixmap(ndarray_to_pixmap(arrows, bgr=True))
|
||||
|
||||
Reference in New Issue
Block a user