This commit is contained in:
bluepulsar
2025-12-31 19:37:33 +08:00
parent fc0025650f
commit fbffe0088f
6 changed files with 44 additions and 29 deletions
+20 -19
View File
@@ -296,21 +296,21 @@ class Sensor:
# 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.
# def update(self):
# """
# Convenience method: get_img + compute_deformation in one call.
Returns:
dict: All sensor data
"""
self.get_img()
self.compute_deformation()
return {
'img': self.__img, 'flow': self.__flow,
'normal': self.__vnormal, 'shear': self.__vshear, 'depth': self.__depth_map,
'fps': self._fps, 'fnormal': self.__fnormal,
'fshearx': self.__fshearx, 'fsheary': self.__fsheary, 'ftor': self.__ftor,
}
# Returns:
# dict: All sensor data
# """
# self.get_img()
# self.compute_deformation()
# return {
# 'img': self.__img, 'flow': self.__flow,
# 'normal': self.__vnormal, 'shear': self.__vshear, 'depth': self.__depth_map,
# 'fps': self._fps, 'fnormal': self.__fnormal,
# 'fshearx': self.__fshearx, 'fsheary': self.__fsheary, 'ftor': self.__ftor,
# }
def read_info(self, *args) -> Tuple:
"""
@@ -478,16 +478,19 @@ class Sensor:
self.cal_path = "./config/cal.npy"
if os.path.exists(self.cal_path):
print("Loading calibration from", self.cal_path)
if self.verbose:
print("Loading calibration from", self.cal_path)
self.stitch_calibration = np.load(self.cal_path, allow_pickle=True)
self.__stitcher.stitch_calibration = self.stitch_calibration
return self.__stitcher.stitch_rt_optimized()
else:
print("Creating new calibration...")
if self.verbose:
print("Creating new calibration...")
img, self.stitch_calibration = self.__stitcher.stitch_cal()
os.makedirs("./config", exist_ok=True)
np.save(self.cal_path, self.stitch_calibration)
print("Calibration saved to", self.cal_path)
if self.verbose:
print("Calibration saved to", self.cal_path)
return img
# =========================================================================
@@ -508,8 +511,6 @@ class Sensor:
if self.verbose:
print(f"Config: {self.config_name}")
print(f" Resolution: {self._config_resolution_raw} → {self._config_resolution_stitch}")
print(f" FPS: {self._config_fps}, Units: {self._config_units}")
return True
def _open_video_source(self, override, box):