added 5 sensors multi-stream support, 5 finger reach > 100 fps stable using .mp4 video
This commit is contained in:
+20
-5
@@ -689,11 +689,19 @@ class Sensor:
|
||||
self.compute_hhd()
|
||||
return True
|
||||
|
||||
def compute_flow(self):
|
||||
if self.img is None:
|
||||
def compute_flow(self, img=None):
|
||||
"""Compute the optical flow for one frame.
|
||||
|
||||
``img`` optionally supplies the frame to use instead of ``self.img``.
|
||||
StreamPipeline passes it explicitly so a producer thread cannot swap
|
||||
``self.img`` between the hand-off and the tracker call. Positional
|
||||
callers and existing code are unaffected.
|
||||
"""
|
||||
image = self.img if img is None else img
|
||||
if image is None:
|
||||
raise Exception("Warning: Get image first")
|
||||
|
||||
flow = self.__tracker.track(self.img, valid_mask=self.valid_mask)
|
||||
flow = self.__tracker.track(image, valid_mask=self.valid_mask)
|
||||
# flow = self.__tracker.track_raft(self.img)
|
||||
if hasattr(flow, 'download'):
|
||||
flow = flow.download()
|
||||
@@ -764,9 +772,16 @@ class Sensor:
|
||||
"""``config``, ``measured`` or ``config (replay)``."""
|
||||
return str(getattr(self, "_force_rate_source", "config"))
|
||||
|
||||
def compute_hhd(self):
|
||||
def compute_hhd(self, flow=None):
|
||||
"""Decompose the optical flow and update the force readout.
|
||||
|
||||
flow = self.flow
|
||||
``flow`` optionally supplies the field to decompose instead of
|
||||
``self.flow``. StreamPipeline passes its own per-frame copy so the flow
|
||||
stage cannot overwrite ``self.flow`` mid-decomposition. Existing
|
||||
callers are unaffected.
|
||||
"""
|
||||
|
||||
flow = self.flow if flow is None else flow
|
||||
if flow is None:
|
||||
raise Exception("Warning: Compute flow first")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user