Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.

Implement 3D bounding box system for computer vision detection#181

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/fix-34
Draft

Implement 3D bounding box system for computer vision detection#181
Copilot wants to merge 5 commits intomainfrom
copilot/fix-34

Conversation

Copy link
Contributor

Copilot AI commented Jul 26, 2025

This PR implements a complete 3D bounding box system to replace the current approach of calculating only 2D bounding boxes with 3D centroid points. The new system provides full 3D spatial extent for detected objects, enabling better spatial understanding for autonomous underwater vehicle operations.

Key Changes

New BoundingBox3D class in custom_types.py:

  • Stores center point and dimensions (width, height, depth)
  • Provides get_corners() method to compute 8 corner points in 3D space
  • Enables full 3D object representation instead of just centroids

Enhanced Detection class:

  • Added bbox_3d field for 3D bounding box information
  • Maintains 100% backward compatibility with existing point field
  • Seamlessly integrates with current detection workflows

3D Bounding Box Calculation:

  • Uses existing 2D YOLO bounding boxes + depth information + camera intrinsics
  • Samples depth at multiple points within bounding box for robust depth estimation
  • Projects 2D corners to 3D space using camera projection equations
  • Estimates object depth from depth variation analysis

Pipeline Integration:

  • Updated DetectionPipelineManager to automatically calculate 3D bounding boxes
  • Enhanced global coordinate transformation to handle both points and 3D bounding boxes
  • No breaking changes - existing code continues to work unchanged

Example Usage

from computer_vision.detection_core import calculate_3d_bounding_boxes

# After getting detections from YOLO
calculate_3d_bounding_boxes(detections, depth_image, camera_intrinsics)

# Access 3D bounding box
if detection.bbox_3d is not None:
    center = detection.bbox_3d.center  # Point3D
    size = (detection.bbox_3d.width, detection.bbox_3d.height, detection.bbox_3d.depth)
    corners = detection.bbox_3d.get_corners()  # List of 8 Point3D objects

Testing

  • Comprehensive test suite validates all functionality
  • End-to-end integration tests confirm pipeline compatibility
  • Example script demonstrates practical usage
  • All existing tests continue to pass

This enhancement provides the underwater vehicle with complete 3D understanding of detected objects, enabling more sophisticated navigation and manipulation tasks while maintaining full backward compatibility.

Fixes #34.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 4 commits July 26, 2025 20:11
Co-authored-by: Cruiz102 <65771578+Cruiz102@users.noreply.github.com>
Co-authored-by: Cruiz102 <65771578+Cruiz102@users.noreply.github.com>
Co-authored-by: Cruiz102 <65771578+Cruiz102@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement a system for 3d bounding boxes Implement 3D bounding box system for computer vision detection Jul 26, 2025
Copilot AI requested a review from Cruiz102 July 26, 2025 20:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement a system for 3d bounding boxes

2 participants