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,
"upper_threshold": 18.0,
"loop_closure_interval": 1,
"algorithm": "raft",
"algorithm": "dis",
"dis_preset": "medium",
"of_mode": 3,
"dis_mode": 3,
"algorithm_list": ["raft", "dis"]
},
"contact": {
+18 -19
View File
@@ -85,7 +85,6 @@ class Sensor:
self.config_name = config_name
self.cal_path = cal_path
self.mirror = mirror
# Load configuration
self.__config_cam = None
@@ -94,17 +93,19 @@ class Sensor:
self._load_config()
# State variables
self.stitch_valid = False
self.stitch_calibration = []
self.stitch_valid = False
self.compute_deformation_valid = False
self.compute_contact_valid = False
# Data Variables (public)
shape = (self.__config_cam["resolution_stitch"][1], self.__config_cam["resolution_stitch"][0])
# Image Data Variables (public)
self.stitch_calibration = []
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_filtered = None
self.initial_img = None
# Optical Flow Data Variables (public)
self.flow = np.zeros(shape + (2,), dtype=np.float32)
self.vnormal = np.zeros_like(self.flow)
self.vshear = np.zeros_like(self.flow)
@@ -123,13 +124,13 @@ class Sensor:
# Async pipeline state
# self._async_enabled = False
self._capture_thread = None
self._flow_thread = None
self._compute_thread = None
self._capture_queue = None
self._flow_queue = None
self._result_queue = None
self._stop_event = None
# self._capture_thread = None
# self._flow_thread = None
# self._compute_thread = None
# self._capture_queue = None
# self._flow_queue = None
# self._result_queue = None
# self._stop_event = None
@@ -147,7 +148,7 @@ class Sensor:
print(f" Stitch mode: {self.stitch_valid}")
print(f" CUDA acceleration: {self.cuda}")
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)
@@ -165,12 +166,10 @@ class Sensor:
print("Failed to get_img from video source.")
return None
self.frame = frame.copy()
# Convert to grayscale
# gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
gray = frame
# Extract and stitch tiles
self.stitcher.get_stitch_unit(gray)
self._extract_tiles(gray)
self.stitcher.get_stitch_unit(frame)
self._extract_tiles(frame)
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)
# 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:
# # CUDA flow method with stream support