update foe to contact for easy understanding

This commit is contained in:
bluepulsar
2025-12-28 20:19:43 +08:00
parent 79c55b7529
commit e8e4fd8625
6 changed files with 493 additions and 49 deletions
+8 -2
View File
@@ -52,7 +52,7 @@ class Sensor:
# =========================================================================
def __init__(self, vid_src, isstitch=False, verbose=True, cuda=True,
config_name="prototype", cal_path=None, override=False, box=None):
config_name="prototype", cal_path=None, override=False, box=None,mirror=True):
"""
Initialize Sensor with video source and configuration.
@@ -83,6 +83,7 @@ class Sensor:
self.verbose = verbose
self.config_name = config_name
self.cal_path = cal_path
self.mirror = mirror
# State variables
self.stitch_valid = False
@@ -183,6 +184,8 @@ class Sensor:
if log_timing:
timings['total'] = (time.perf_counter() - t_start) * 1000
self._print_timings("get_img", timings)
if self.mirror:
self.img = cv2.flip(self.img, 1)
return self.img
@@ -241,13 +244,16 @@ class Sensor:
return self.flow
def get_foe(self, multiple_foe=False, min_contour_area=3000, min_magnitude=1.0, expansion_threshold=0.01, downsample_factor=1, kernel_size=(5,5), denoise_sigma=15):
def get_contact(self, multiple_foe=False, min_contour_area=3000, min_magnitude=1.0, expansion_threshold=0.01, downsample_factor=1, kernel_size=(5,5), denoise_sigma=15):
if multiple_foe:
return compute_multiple_foe(self.vnormal, min_contour_area=min_contour_area, min_magnitude=min_magnitude, expansion_threshold=expansion_threshold, downsample_factor=downsample_factor, kernel_size=kernel_size, denoise_sigma=denoise_sigma)
else:
return compute_foe(self.vnormal, min_magnitude=min_magnitude, expansion_threshold=expansion_threshold, downsample_factor=downsample_factor, kernel_size=kernel_size, denoise_sigma=denoise_sigma)
def get_depth(self, denoise_sigma=15):
return getFilteredDensity(self.vnormal, use_cuda=self.cuda)
self.depth = getFilteredDensity(self.vnormal, use_cuda=self.cuda)
def update(self):
"""
Convenience method: get_img + compute_deformation in one call.