diff --git a/config/prototype_of3.json b/config/prototype_of3.json index 57b6e23..9b5627e 100644 --- a/config/prototype_of3.json +++ b/config/prototype_of3.json @@ -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": { diff --git a/src/orisys/sensor.py b/src/orisys/sensor.py index 86b3412..1076cb3 100644 --- a/src/orisys/sensor.py +++ b/src/orisys/sensor.py @@ -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()) diff --git a/src/orisys/tracker.py b/src/orisys/tracker.py index b298376..20edea0 100644 --- a/src/orisys/tracker.py +++ b/src/orisys/tracker.py @@ -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