update for clarity

This commit is contained in:
bluepulsar
2026-02-01 10:14:56 +08:00
parent 94cac70e6e
commit 29e10c7f94
3 changed files with 21 additions and 22 deletions
+2 -2
View File
@@ -24,9 +24,9 @@
"lower_threshold": 12.0, "lower_threshold": 12.0,
"upper_threshold": 18.0, "upper_threshold": 18.0,
"loop_closure_interval": 1, "loop_closure_interval": 1,
"algorithm": "raft", "algorithm": "dis",
"dis_preset": "medium", "dis_preset": "medium",
"of_mode": 3, "dis_mode": 3,
"algorithm_list": ["raft", "dis"] "algorithm_list": ["raft", "dis"]
}, },
"contact": { "contact": {
+17 -18
View File
@@ -86,7 +86,6 @@ class Sensor:
self.cal_path = cal_path self.cal_path = cal_path
self.mirror = mirror self.mirror = mirror
# Load configuration # Load configuration
self.__config_cam = None self.__config_cam = None
self.__config_stitcher = None self.__config_stitcher = None
@@ -95,16 +94,18 @@ class Sensor:
# State variables # State variables
self.stitch_valid = False self.stitch_valid = False
self.stitch_calibration = []
self.compute_deformation_valid = False self.compute_deformation_valid = False
self.compute_contact_valid = False self.compute_contact_valid = False
# Data Variables (public) # Image Data Variables (public)
shape = (self.__config_cam["resolution_stitch"][1], self.__config_cam["resolution_stitch"][0]) self.stitch_calibration = []
self.frame = self.img = None self.frame = self.img = None
self.initial_img = None
shape = (self.__config_cam["resolution_stitch"][1], self.__config_cam["resolution_stitch"][0])
self.img_size_raw = None self.img_size_raw = None
self.img_filtered = None self.img_filtered = None
self.initial_img = None
# Optical Flow Data Variables (public)
self.flow = np.zeros(shape + (2,), dtype=np.float32) self.flow = np.zeros(shape + (2,), dtype=np.float32)
self.vnormal = np.zeros_like(self.flow) self.vnormal = np.zeros_like(self.flow)
self.vshear = np.zeros_like(self.flow) self.vshear = np.zeros_like(self.flow)
@@ -123,13 +124,13 @@ class Sensor:
# Async pipeline state # Async pipeline state
# self._async_enabled = False # self._async_enabled = False
self._capture_thread = None # self._capture_thread = None
self._flow_thread = None # self._flow_thread = None
self._compute_thread = None # self._compute_thread = None
self._capture_queue = None # self._capture_queue = None
self._flow_queue = None # self._flow_queue = None
self._result_queue = None # self._result_queue = None
self._stop_event = None # self._stop_event = None
@@ -147,7 +148,7 @@ class Sensor:
print(f" Stitch mode: {self.stitch_valid}") print(f" Stitch mode: {self.stitch_valid}")
print(f" CUDA acceleration: {self.cuda}") print(f" CUDA acceleration: {self.cuda}")
print(f" CuPy available: {self.CUPY_AVAILABLE}") print(f" CuPy available: {self.CUPY_AVAILABLE}")
print(f" OpenCV CUDA devices: {cv2.cuda.getCudaEnabledDeviceCount()}") print(f" Optical flow algorithm: {self.__config_tracker['algorithm']}")
# ========================================================================= # =========================================================================
# Public API - Core Methods (Most Frequently Used) # Public API - Core Methods (Most Frequently Used)
@@ -165,12 +166,10 @@ class Sensor:
print("Failed to get_img from video source.") print("Failed to get_img from video source.")
return None return None
self.frame = frame.copy() self.frame = frame.copy()
# Convert to grayscale
# gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
gray = frame
# Extract and stitch tiles # Extract and stitch tiles
self.stitcher.get_stitch_unit(gray) self.stitcher.get_stitch_unit(frame)
self._extract_tiles(gray) self._extract_tiles(frame)
img = np.ascontiguousarray(self.stitcher.stitch_rt_optimized()) img = np.ascontiguousarray(self.stitcher.stitch_rt_optimized())
+1 -1
View File
@@ -54,7 +54,7 @@ class Tracker:
self.__tracking_inst = cv2.DISOpticalFlow_create(preset) self.__tracking_inst = cv2.DISOpticalFlow_create(preset)
# Aggressive optimization for CPU # Aggressive optimization for CPU
self.__tracking_inst.setFinestScale(config_tracker["of_mode"]) # Skip finest pyramid level (2x faster) self.__tracking_inst.setFinestScale(config_tracker["dis_mode"]) # Skip finest pyramid level (2x faster)
# else: # else:
# # CUDA flow method with stream support # # CUDA flow method with stream support