Process a single image and its associated data. This method handles image transformations, depth processing, and coordinate conversions. Args: image (numpy.ndarray): Input image array depth_map (numpy.ndarray): Depth map array extri_open
(
self,
image,
depth_map,
extri_opencv,
intri_opencv,
original_size,
target_image_shape,
track=None,
filepath=None,
safe_bound=4,
)
| 488 | |
| 489 | |
| 490 | def process_one_image( |
| 491 | self, |
| 492 | image, |
| 493 | depth_map, |
| 494 | extri_opencv, |
| 495 | intri_opencv, |
| 496 | original_size, |
| 497 | target_image_shape, |
| 498 | track=None, |
| 499 | filepath=None, |
| 500 | safe_bound=4, |
| 501 | ): |
| 502 | """ |
| 503 | Process a single image and its associated data. |
| 504 | |
| 505 | This method handles image transformations, depth processing, and coordinate conversions. |
| 506 | |
| 507 | Args: |
| 508 | image (numpy.ndarray): Input image array |
| 509 | depth_map (numpy.ndarray): Depth map array |
| 510 | extri_opencv (numpy.ndarray): Extrinsic camera matrix (OpenCV convention) |
| 511 | intri_opencv (numpy.ndarray): Intrinsic camera matrix (OpenCV convention) |
| 512 | original_size (numpy.ndarray): Original image size [height, width] |
| 513 | target_image_shape (numpy.ndarray): Target image shape after processing |
| 514 | track (numpy.ndarray, optional): Optional tracking information. Defaults to None. |
| 515 | filepath (str, optional): Optional file path for debugging. Defaults to None. |
| 516 | safe_bound (int, optional): Safety margin for cropping operations. Defaults to 4. |
| 517 | |
| 518 | Returns: |
| 519 | tuple: ( |
| 520 | image (numpy.ndarray): Processed image, |
| 521 | depth_map (numpy.ndarray): Processed depth map, |
| 522 | extri_opencv (numpy.ndarray): Updated extrinsic matrix, |
| 523 | intri_opencv (numpy.ndarray): Updated intrinsic matrix, |
| 524 | world_coords_points (numpy.ndarray): 3D points in world coordinates, |
| 525 | cam_coords_points (numpy.ndarray): 3D points in camera coordinates, |
| 526 | point_mask (numpy.ndarray): Boolean mask of valid points, |
| 527 | track (numpy.ndarray, optional): Updated tracking information |
| 528 | ) |
| 529 | """ |
| 530 | # Make copies to avoid in-place operations affecting original data |
| 531 | image = np.copy(image) |
| 532 | depth_map = np.copy(depth_map) |
| 533 | extri_opencv = np.copy(extri_opencv) |
| 534 | intri_opencv = np.copy(intri_opencv) |
| 535 | if track is not None: |
| 536 | track = np.copy(track) |
| 537 | |
| 538 | # Apply random scale augmentation during training if enabled |
| 539 | if self.training and self.aug_scale: |
| 540 | random_h_scale, random_w_scale = np.random.uniform( |
| 541 | self.aug_scale[0], self.aug_scale[1], 2 |
| 542 | ) |
| 543 | # Avoid random padding by capping at 1.0 |
| 544 | random_h_scale = min(random_h_scale, 1.0) |
| 545 | random_w_scale = min(random_w_scale, 1.0) |
| 546 | aug_size = original_size * np.array([random_h_scale, random_w_scale]) |
| 547 | aug_size = aug_size.astype(np.int32) |
nothing calls this directly
no test coverage detected