config json update

This commit is contained in:
unknown
2025-12-30 11:07:45 +08:00
parent 88b48f8fa8
commit 2a739ed27c
6 changed files with 47 additions and 40 deletions
+6 -4
View File
@@ -6,14 +6,16 @@
"fps": 60, "fps": 60,
"units": 15, "units": 15,
"units_used": 9, "units_used": 9,
"resolution_stitch": [400, 400], "resolution_stitch": [400, 400]
"index": [1,2,3,6,7,8,11,12,13],
"pos_default": [[260, 56], [577, 62], [897, 69], [1214, 75], [1530, 81], [256, 391], [570, 397], [889, 403], [1208, 409], [1523, 416], [248, 724], [563, 730], [882, 738], [1201, 743], [1516, 751]]
}, },
"stitcher": { "stitcher": {
"min_area_frac": 0.018, "min_area_frac": 0.018,
"max_area_frac": 0.035, "max_area_frac": 0.035,
"max_aspect_ratio": 20 "max_aspect_ratio": 20,
"index": [1,2,3,6,7,8,11,12,13],
"pos_default": [[260, 56], [577, 62], [897, 69], [1214, 75], [1530, 81], [256, 391], [570, 397], [889, 403], [1208, 409], [1523, 416], [248, 724], [563, 730], [882, 738], [1201, 743], [1516, 751]],
"margin": 10,
"nominal_ov_pos": 100
}, },
"contact": { "contact": {
"min_contour_area": 3000, "min_contour_area": 3000,
+1 -1
View File
@@ -28,7 +28,7 @@ def main():
# verbose: 是否打印详细初始化日志 # verbose: 是否打印详细初始化日志
# 方式1: 从视频文件读取 # 方式1: 从视频文件读取
sensor = orisys.Sensor("./s1.mp4", isstitch=True, cuda=False, verbose=True) sensor = orisys.Sensor("./s1.mp4", isstitch=True, cuda=False, verbose=True,config_name="prototype")
# 方式2: 从摄像头读取(取消注释使用) # 方式2: 从摄像头读取(取消注释使用)
# sensor = orisys.Sensor(0, isstitch=True, cuda=True, verbose=True) # sensor = orisys.Sensor(0, isstitch=True, cuda=True, verbose=True)
+6 -5
View File
@@ -6,11 +6,12 @@ import cv2
class Stitcher: class Stitcher:
def __init__(self,isstitch=False, n=[3,3], index=np.array([1,2,3,6,7,8,11,12,13]), config_stitcher=None): def __init__(self,isstitch=False, n=[3,3], config_stitcher=None,verbose=False):
# Settings # Settings
self.isstitch = isstitch self.isstitch = isstitch
self.config_stitcher = config_stitcher self.config_stitcher = config_stitcher
self.verbose = verbose
# Find Boxes Related # Find Boxes Related
self.min_area_frac = config_stitcher["min_area_frac"] self.min_area_frac = config_stitcher["min_area_frac"]
self.max_area_frac = config_stitcher["max_area_frac"] self.max_area_frac = config_stitcher["max_area_frac"]
@@ -19,16 +20,16 @@ class Stitcher:
# stitch related # stitch related
self.stitch_valid = False self.stitch_valid = False
self.boxes = self.units = None self.boxes = self.units = None
self.index = index self.index = config_stitcher["index"]
self.stitch_calibration = self.tile_list = [] self.stitch_calibration = self.tile_list = []
self.ncol = n[0] self.ncol = n[0]
self.nrow = n[1] self.nrow = n[1]
self.nominal_ov_pos=100 self.nominal_ov_pos=config_stitcher["nominal_ov_pos"]
self.margin=10 self.margin=config_stitcher["margin"]
self.bound=self.nominal_ov_pos - self.margin self.bound=self.nominal_ov_pos - self.margin
# for sensor 1 # for sensor 1
self.pos_default = [(260, 56), (577, 62), (897, 69), (1214, 75), (1530, 81), (256, 391), (570, 397), (889, 403), (1208, 409), (1523, 416), (248, 724), (563, 730), (882, 738), (1201, 743), (1516, 751)] self.pos_default = config_stitcher["pos_default"]
def stitch_rt_optimized(self, change_sv=False, s_mean=28., v_mean=180.): def stitch_rt_optimized(self, change_sv=False, s_mean=28., v_mean=180.):
tile_list = self.tile_list tile_list = self.tile_list
+6 -4
View File
@@ -6,14 +6,16 @@
"fps": 60, "fps": 60,
"units": 15, "units": 15,
"units_used": 9, "units_used": 9,
"resolution_stitch": [400, 400], "resolution_stitch": [400, 400]
"index": [1,2,3,6,7,8,11,12,13],
"pos_default": [[260, 56], [577, 62], [897, 69], [1214, 75], [1530, 81], [256, 391], [570, 397], [889, 403], [1208, 409], [1523, 416], [248, 724], [563, 730], [882, 738], [1201, 743], [1516, 751]]
}, },
"stitcher": { "stitcher": {
"min_area_frac": 0.018, "min_area_frac": 0.018,
"max_area_frac": 0.035, "max_area_frac": 0.035,
"max_aspect_ratio": 20 "max_aspect_ratio": 20,
"index": [1,2,3,6,7,8,11,12,13],
"pos_default": [[260, 56], [577, 62], [897, 69], [1214, 75], [1530, 81], [256, 391], [570, 397], [889, 403], [1208, 409], [1523, 416], [248, 724], [563, 730], [882, 738], [1201, 743], [1516, 751]],
"margin": 10,
"nominal_ov_pos": 100
}, },
"contact": { "contact": {
"min_contour_area": 3000, "min_contour_area": 3000,
+4 -4
View File
@@ -132,8 +132,8 @@ class Sensor:
# Initialize components # Initialize components
self._stitcher = Stitcher(isstitch=isstitch, index=self.config_index, config_stitcher=self.config_stitcher) self._stitcher = Stitcher(isstitch=isstitch, config_stitcher=self.config_stitcher, verbose=self.verbose)
self.tracker = Tracker(adaptive=True, cuda=cuda) self.tracker = Tracker(adaptive=True, cuda=cuda, verbose=self.verbose)
self.contact3d = Contact3D(config_contact=self.config_contact, verbose=self.verbose) self.contact3d = Contact3D(config_contact=self.config_contact, verbose=self.verbose)
self.hhd = None self.hhd = None
@@ -459,8 +459,8 @@ class Sensor:
self.config_fps = cam["fps"] self.config_fps = cam["fps"]
self.config_units = cam["units"] self.config_units = cam["units"]
self.config_resolution_stitch = cam["resolution_stitch"] self.config_resolution_stitch = cam["resolution_stitch"]
self.config_index = cam["index"] # self.config_index = cam["index"]
self.config_pos_default = cam["pos_default"] # self.config_pos_default = cam["pos_default"]
self.config_stitcher = self.config["stitcher"] self.config_stitcher = self.config["stitcher"]
self.config_contact = self.config["contact"] self.config_contact = self.config["contact"]
+3 -1
View File
@@ -12,13 +12,15 @@ class Tracker:
lower_threshold=12.0, lower_threshold=12.0,
upper_threshold=18.0, upper_threshold=18.0,
loop_closure_interval=1, loop_closure_interval=1,
dis_preset='medium'): dis_preset='medium',
verbose=False):
# Check if OpenCV is built with CUDA support # Check if OpenCV is built with CUDA support
if cuda and not cv2.cuda.getCudaEnabledDeviceCount(): if cuda and not cv2.cuda.getCudaEnabledDeviceCount():
# print("Warning: CUDA requested but OpenCV not built with CUDA support or no CUDA device found. Falling back to CPU.") # print("Warning: CUDA requested but OpenCV not built with CUDA support or no CUDA device found. Falling back to CPU.")
cuda = False cuda = False
self.cuda = cuda self.cuda = cuda
self.verbose = verbose
self.__loop_closure_interval = loop_closure_interval self.__loop_closure_interval = loop_closure_interval
self.__frame_count = 0 self.__frame_count = 0