update wuxi demo

This commit is contained in:
ykcheungab
2026-04-11 12:20:16 +08:00
parent ea21302d7f
commit 92d68cc80e
10 changed files with 696 additions and 13 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ A Python library for processing and analyzing optical tactile sensor data,
including image stitching, optical flow tracking, and deformation decomposition.
"""
__version__ = "0.3.1"
__version__ = "0.3.2"
__author__ = "Orisys"
from .sensor import Sensor
+8 -2
View File
@@ -119,6 +119,7 @@ class Sensor:
shape = (self.__config_cam["resolution_stitch"][1], self.__config_cam["resolution_stitch"][0])
self.img_size_raw = None
self.img_filtered = None
self.tail_frames_count = 0
# Optical Flow Data Variables (public)
self.flow = np.zeros(shape + (2,), dtype=np.float32)
@@ -268,7 +269,7 @@ class Sensor:
# print(f"mag: {mag.max()}, {mag.min()}, {mag.mean()}")
return mag.mean() > threshold
def compute_deformation(self, decompose=True, check_motion=True, threshold=6):
def compute_deformation(self, decompose=True, check_motion=False, threshold=6, tail_frames = 5):
"""
Compute optical flow and decompose into force components.
@@ -282,9 +283,14 @@ class Sensor:
# self.compute_hhd()
if check_motion:
if self.detect_motion(threshold=threshold):
self.tail_frames_count = 0
self.compute_hhd()
return True
else:
else:
if self.tail_frames_count <= tail_frames:
self.tail_frames_count +=1
self.compute_hhd()
return True
return False
else:
if decompose:
+2 -2
View File
@@ -85,11 +85,11 @@ class Tracker:
def track(self, frame):
"""Main tracking function that dispatches to CUDA or CPU implementation"""
if self.__algorithm == "raft":
return self.track_raft(frame)
return self.track_raft(frame.copy())
elif self.__algorithm == "dis":
if frame.ndim == 3:
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
return self.track_cpu(frame)
return self.track_cpu(frame.copy())
def track_cpu(self, frame):
"""CPU-based optical flow tracking"""