update torch conditional import

This commit is contained in:
bluepulsar
2026-02-12 10:15:54 +08:00
parent af8aee402e
commit 233ae84103
4 changed files with 17 additions and 9 deletions
+6 -2
View File
@@ -127,7 +127,7 @@ def draw_magnitude_map(vfield, threshold=3.0, colormap=cv2.COLORMAP_JET) -> np.n
npoints = 100 # 图表数据长度
npoints = 400 # 图表数据长度
plot_threshold = 0 # only plot force values above this (below → 0)
pg.setConfigOption('background', bg_color_hex)
pg.setConfigOption('foreground', bg_color_hex)
@@ -154,7 +154,7 @@ def main():
pyqt_writer = cv2.VideoWriter(args.video.replace(".mp4", "_pyqt.mp4"), cv2.VideoWriter_fourcc(*'mp4v'), fps_video, (1600, 1200))
depth_writer = cv2.VideoWriter(args.video.replace(".mp4", "_depth.mp4"), cv2.VideoWriter_fourcc(*'mp4v'),fps_video, (384, 384))
sensor1 = orisys.Sensor(args.video, config_name="./config/prototype_of3.json", cal_path= args.video.replace(".mp4", ".npy"), isstitch=True, cuda=True, verbose=True)
sensor1 = orisys.Sensor(args.video, config_name="./config/prototype_raft.json", cal_path= args.video.replace(".mp4", ".npy"), isstitch=True, cuda=True, verbose=True)
start_time = time.time()
is_save = False
@@ -203,6 +203,10 @@ def main():
data[:-1, 1, i] = data[1:, 1, i] # shift force data left
data[-1, 0, :] = frame_count/fps_video # set current time for all plots
data[-1, 1, 0] = fn
if abs(fx) - data[-2, 1, 1] > 100000:
fx = data[-2, 1, 1] + data[-2, 1, 1]*0.5
if abs(fy) - data[-2, 1, 2] > 100000:
fy = data[-2, 1, 2] + data[-2, 1, 2]*0.5
data[-1, 1, 1] = abs(fx)
data[-1, 1, 2] = abs(fy)
# Moving average on force data (column 1): simple loop, no singularities at ends