change render switches
This commit is contained in:
parent
8bcca04ecc
commit
dc5e2ff28c
5 changed files with 54 additions and 51 deletions
|
@ -79,6 +79,7 @@ class AnimationRenderer:
|
|||
|
||||
display = pyglet.canvas.get_display()
|
||||
screen = display.get_screens()[0]
|
||||
print(display.get_screens())
|
||||
|
||||
if self.streaming_process is not None:
|
||||
self.window = pyglet.window.Window(width=self.frame_size[0], height=self.frame_size[1], config=config, fullscreen=False, screen=screen)
|
||||
|
|
|
@ -336,8 +336,8 @@ render_parser.add_argument("--render-file",
|
|||
render_parser.add_argument("--render-window",
|
||||
help="Render a previewing to a window",
|
||||
action='store_true')
|
||||
render_parser.add_argument("--render-no-preview",
|
||||
help="No preview, but only animation",
|
||||
render_parser.add_argument("--render-animation",
|
||||
help="Render animation (pyglet)",
|
||||
action='store_true')
|
||||
render_parser.add_argument("--render-debug-shapes",
|
||||
help="Lines and points for debugging/mapping",
|
||||
|
|
|
@ -442,7 +442,7 @@ colorset = [
|
|||
# ]
|
||||
|
||||
def get_opacity(track: Track, current_frame: Frame):
|
||||
fade_duration = current_frame.camera.fps * 3
|
||||
fade_duration = current_frame.camera.fps * 1.5
|
||||
diff = current_frame.index - track.history[-1].frame_nr
|
||||
return max(0, 1 - diff / fade_duration)
|
||||
# track.history[-1].frame_nr < (current_frame.index - current_frame.camera.fps * 3)
|
||||
|
|
|
@ -92,16 +92,16 @@ def start():
|
|||
ExceptionHandlingProcess(target=run_tracker, kwargs={'config': args, 'is_running': isRunning}, name='tracker'),
|
||||
]
|
||||
|
||||
if args.render_file or args.render_url or args.render_window:
|
||||
if not args.render_no_preview: #or args.render_file or args.render_url:
|
||||
procs.append(
|
||||
# ExceptionHandlingProcess(target=run_cv_renderer, kwargs={'config': args, 'is_running': isRunning}, name='preview')
|
||||
ExceptionHandlingProcess(target=run_cv_renderer, kwargs={'config': args, 'is_running': isRunning}, name='preview')
|
||||
)
|
||||
if args.render_no_preview:
|
||||
procs.append(
|
||||
ExceptionHandlingProcess(target=run_animation_renderer, kwargs={'config': args, 'is_running': isRunning}, name='renderer')
|
||||
)
|
||||
# if args.render_file or args.render_url or args.render_window:
|
||||
if args.render_window or args.render_file or args.render_url:
|
||||
procs.append(
|
||||
# ExceptionHandlingProcess(target=run_cv_renderer, kwargs={'config': args, 'is_running': isRunning}, name='preview')
|
||||
ExceptionHandlingProcess(target=run_cv_renderer, kwargs={'config': args, 'is_running': isRunning}, name='preview')
|
||||
)
|
||||
if args.render_animation:
|
||||
procs.append(
|
||||
ExceptionHandlingProcess(target=run_animation_renderer, kwargs={'config': args, 'is_running': isRunning}, name='renderer')
|
||||
)
|
||||
|
||||
if not args.bypass_prediction:
|
||||
procs.append(
|
||||
|
|
|
@ -185,28 +185,29 @@ class DrawnTrack:
|
|||
self.shapes = self.shapes[:len(drawn_positions)]
|
||||
|
||||
# for i, pos in drawn_positions.enumerate():
|
||||
for ci in range(1, len(drawn_positions)):
|
||||
x, y = [int(p) for p in drawn_positions[ci-1]]
|
||||
x2, y2 = [int(p) for p in drawn_positions[ci]]
|
||||
if True:
|
||||
for ci in range(1, len(drawn_positions)):
|
||||
x, y = [int(p) for p in drawn_positions[ci-1]]
|
||||
x2, y2 = [int(p) for p in drawn_positions[ci]]
|
||||
|
||||
y, y2 = self.renderer.window.height - y, self.renderer.window.height - y2
|
||||
color = [100+155*ci // len(drawn_positions)]*3
|
||||
# print(x,y,x2,y2,color)
|
||||
y, y2 = self.renderer.window.height - y, self.renderer.window.height - y2
|
||||
color = [100+155*ci // len(drawn_positions)]*3
|
||||
# print(x,y,x2,y2,color)
|
||||
|
||||
if ci >= len(self.shapes):
|
||||
# TODO: add color2
|
||||
line = self.renderer.gradientLine(x, y, x2, y2, 3, color, color, batch=self.renderer.batch_anim)
|
||||
line = pyglet.shapes.Arc(x2, y2, 10, thickness=2, color=color, batch=self.renderer.batch_anim)
|
||||
line.opacity = 20
|
||||
self.shapes.append(line)
|
||||
|
||||
else:
|
||||
line = self.shapes[ci-1]
|
||||
line.x, line.y = x, y
|
||||
line.x2, line.y2 = x2, y2
|
||||
line.radius = int(exponentialDecay(line.radius, 1.5, 3, dt))
|
||||
line.color = color
|
||||
line.opacity = int(exponentialDecay(line.opacity, 180, 8, dt))
|
||||
if ci >= len(self.shapes):
|
||||
# TODO: add color2
|
||||
# line = self.renderer.gradientLine(x, y, x2, y2, 3, color, color, batch=self.renderer.batch_anim)
|
||||
line = pyglet.shapes.Arc(x2, y2, 10, thickness=2, color=color, batch=self.renderer.batch_anim)
|
||||
line.opacity = 20
|
||||
self.shapes.append(line)
|
||||
|
||||
else:
|
||||
line = self.shapes[ci-1]
|
||||
line.x, line.y = x, y
|
||||
# line.x2, line.y2 = x2, y2
|
||||
line.radius = int(exponentialDecay(line.radius, 1.5, 3, dt))
|
||||
line.color = color
|
||||
line.opacity = int(exponentialDecay(line.opacity, 180, 8, dt))
|
||||
|
||||
# TODO: basically a duplication of the above, do this smarter?
|
||||
# TODO: add intermediate segment
|
||||
|
@ -216,26 +217,27 @@ class DrawnTrack:
|
|||
self.pred_history_shapes = self.pred_history_shapes[:len(drawn_pred_history)]
|
||||
|
||||
# for i, pos in drawn_pred_history.enumerate():
|
||||
for ci in range(1, len(drawn_pred_history)):
|
||||
x, y = [int(p) for p in drawn_pred_history[ci-1]]
|
||||
x2, y2 = [int(p) for p in drawn_pred_history[ci]]
|
||||
if False:
|
||||
for ci in range(1, len(drawn_pred_history)):
|
||||
x, y = [int(p) for p in drawn_pred_history[ci-1]]
|
||||
x2, y2 = [int(p) for p in drawn_pred_history[ci]]
|
||||
|
||||
y, y2 = self.renderer.window.height - y, self.renderer.window.height - y2
|
||||
y, y2 = self.renderer.window.height - y, self.renderer.window.height - y2
|
||||
|
||||
if ci >= len(self.pred_history_shapes):
|
||||
# line = self.renderer.gradientLine(x, y, x2, y2, 3, color, color, batch=self.renderer.batch_anim)
|
||||
line = pyglet.shapes.Line(x,y ,x2, y2, 2.5, color, batch=self.renderer.batch_anim)
|
||||
# line = pyglet.shapes.Arc(x2, y2, 10, thickness=2, color=color, batch=self.renderer.batch_anim)
|
||||
line.opacity = 120
|
||||
self.pred_history_shapes.append(line)
|
||||
|
||||
else:
|
||||
line = self.pred_history_shapes[ci-1]
|
||||
line.x, line.y = x, y
|
||||
line.x2, line.y2 = x2, y2
|
||||
# line.radius = int(exponentialDecay(line.radius, 1.5, 3, dt))
|
||||
line.color = color
|
||||
line.opacity = int(exponentialDecay(line.opacity, 180, 8, dt))
|
||||
if ci >= len(self.pred_history_shapes):
|
||||
# line = self.renderer.gradientLine(x, y, x2, y2, 3, color, color, batch=self.renderer.batch_anim)
|
||||
line = pyglet.shapes.Line(x,y ,x2, y2, 2.5, color, batch=self.renderer.batch_anim)
|
||||
# line = pyglet.shapes.Arc(x2, y2, 10, thickness=2, color=color, batch=self.renderer.batch_anim)
|
||||
line.opacity = 120
|
||||
self.pred_history_shapes.append(line)
|
||||
|
||||
else:
|
||||
line = self.pred_history_shapes[ci-1]
|
||||
line.x, line.y = x, y
|
||||
line.x2, line.y2 = x2, y2
|
||||
# line.radius = int(exponentialDecay(line.radius, 1.5, 3, dt))
|
||||
line.color = color
|
||||
line.opacity = int(exponentialDecay(line.opacity, 180, 8, dt))
|
||||
|
||||
|
||||
for a, drawn_prediction in enumerate(drawn_predictions):
|
||||
|
|
Loading…
Reference in a new issue