add config dictionary to get_depth.py

This commit is contained in:
unknown
2025-12-30 10:25:16 +08:00
parent b9573c5781
commit 93e2984e7f
6 changed files with 358 additions and 334 deletions
+11 -10
View File
@@ -20,7 +20,7 @@ from .tracker import Tracker
from .nHHD import nHHD
# from .getDensity import getFilteredDensity
from . import configs
from .get_depth import *
from .get_depth import Contact3D
class Sensor:
@@ -132,8 +132,9 @@ class Sensor:
# Initialize components
self._stitcher = Stitcher(isstitch=isstitch, index=self.config_index)
self._stitcher = Stitcher(isstitch=isstitch, index=self.config_index, config_stitcher=self.config_stitcher)
self.tracker = Tracker(adaptive=True, cuda=cuda)
self.contact3d = Contact3D(config_contact=self.config_contact, verbose=self.verbose)
self.hhd = None
# Setup video capture
@@ -261,14 +262,15 @@ class Sensor:
def compute_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:
result = 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)
# result = 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)
result = self.contact3d.compute_multiple_foe(self.vnormal)
else:
if self.cuda:
result = compute_foe_gpu(self.vnormal, min_magnitude=min_magnitude, expansion_threshold=expansion_threshold, downsample_factor=downsample_factor, kernel_size=kernel_size, denoise_sigma=denoise_sigma)
# result = compute_foe_gpu(self.vnormal, min_magnitude=min_magnitude, expansion_threshold=expansion_threshold, downsample_factor=downsample_factor, kernel_size=kernel_size, denoise_sigma=denoise_sigma)
result = self.contact3d.compute_foe_gpu(self.vnormal)
else:
result = compute_foe(self.vnormal, min_magnitude=min_magnitude, expansion_threshold=expansion_threshold, downsample_factor=downsample_factor, kernel_size=kernel_size, denoise_sigma=denoise_sigma)
# result = compute_foe(self.vnormal, min_magnitude=min_magnitude, expansion_threshold=expansion_threshold, downsample_factor=downsample_factor, kernel_size=kernel_size, denoise_sigma=denoise_sigma)
result = self.contact3d.compute_foe(self.vnormal)
self.centroid = result['centroid']
self.centroid_found = result['centroid_found']
@@ -457,9 +459,8 @@ class Sensor:
self.config_index = cam["index"]
self.config_pos_default = cam["pos_default"]
config_stitcher = self.config["stitcher"]
config_contact = self.config["contact"]
self.config_stitcher = self.config["stitcher"]
self.config_contact = self.config["contact"]