add override option

This commit is contained in:
unknown
2025-12-26 12:38:33 +08:00
parent a62f3aa283
commit a540a30ed5
4 changed files with 23 additions and 7 deletions
+1 -1
View File
@@ -473,7 +473,7 @@ class Stitcher:
n_boxes = len(boxes)
bk_thresh += bk_thresh_step
# print("Detected {} candidate boxes with bk_thresh={}".format(n_boxes, bk_thresh - bk_thresh_step))
print("Detected {} candidate boxes with bk_thresh={}".format(n_boxes, bk_thresh - bk_thresh_step))
if n_boxes == 0:
self.boxes = []
return n_boxes
+14 -5
View File
@@ -19,7 +19,7 @@ class Sensor:
Sensor helper that can decompose optical flow via Fourier methods.
Stores the decomposed components and global norms as attributes after compute().
"""
def __init__(self, vid_src, isstitch=False, verbose=True, cuda=True):
def __init__(self, vid_src, isstitch=False, verbose=True, cuda=True, override=False, box=None):
"""
Initialize Sensor with video source and configuration.
@@ -70,13 +70,22 @@ class Sensor:
if self.verbose:
print("Video source connected.")
# Initialize and calibrate
self.__find_stitch_boxes(frame, show=False)
self.__get_tiles(frame)
self.stitch_cal()
if override:
if box is not None:
self.__stitcher.boxes = box
else:
print("Override is True but no box provided.")
else:
# Initialize and calibrate
self.__find_stitch_boxes(frame, show=False)
self.__get_tiles(frame)
self.stitch_cal()
if self.verbose:
print("Sensor initialized and calibrated.")
# Initialize state variables
self.stitch_valid = False
self.n_boxes = None