vehicle_common.cv.tracking#
Attributes#
Functions#
|
|
|
|
|
Use the focused-DLZ classifier first, then fall back to HSV if needed. |
|
Detect the requested payload paper or return the DLZ centre as a fallback. |
|
Rotate an image by the specified angle. |
|
Detect payload in image using color thresholding. |
|
Convert pixel coordinates to a 3D direction vector. |
Module Contents#
- _NAMED_PAYLOAD_BOUNDS#
- _PAPER_MASK_KEYS#
- _normalize_payload_color(payload_color: str | None, lower_payload: numpy.ndarray | None, upper_payload: numpy.ndarray | None) str#
- _largest_contour_centroid(mask: numpy.ndarray) tuple[numpy.ndarray | None, int | None, int | None]#
- _legacy_focused_payload_mask(focused_bgr: numpy.ndarray, lower_payload: numpy.ndarray | None, upper_payload: numpy.ndarray | None) numpy.ndarray#
- _resolved_payload_mask(focused_bgr: numpy.ndarray, requested_color: str, lower_payload: numpy.ndarray | None, upper_payload: numpy.ndarray | None, paper_masks: dict[str, numpy.ndarray]) numpy.ndarray#
Use the focused-DLZ classifier first, then fall back to HSV if needed.
- find_payload(image: numpy.ndarray, lower_zone: numpy.ndarray, upper_zone: numpy.ndarray, lower_payload: numpy.ndarray | None, upper_payload: numpy.ndarray | None, uuid: str, debug: bool = False, save_vision: bool = False, payload_color: str | None = None) Tuple[int, int, bool] | None#
Detect the requested payload paper or return the DLZ centre as a fallback.
- Parameters:
image (np.ndarray) – Input BGR image.
lower_zone (np.ndarray) – Lower HSV threshold for zone marker.
upper_zone (np.ndarray) – Upper HSV threshold for zone marker.
lower_payload (np.ndarray | None) – Optional HSV fallback lower bound.
upper_payload (np.ndarray | None) – Optional HSV fallback upper bound.
debug (bool) – If True, return an image with visualizations.
save_vision (bool) – If True, save the visualization image.
payload_color (str | None) – Requested paper colour name.
- Returns:
A tuple (cx, cy, dlz_empty) if detection is successful; otherwise, None.
- Return type:
Optional[Tuple[int, int, bool]]
- rotate_image(image: numpy.ndarray, angle: float) numpy.ndarray#
Rotate an image by the specified angle.
- Parameters:
image (np.ndarray) – The input image.
angle (float) – The rotation angle in degrees. Typically, use the negative of the camera yaw to compensate for rotation.
- Returns:
The rotated image.
- Return type:
np.ndarray
- find_dlz(image: numpy.ndarray, lower_pink: numpy.ndarray, upper_pink: numpy.ndarray, lower_green: numpy.ndarray, upper_green: numpy.ndarray, debug: bool = False) Tuple[int, int, numpy.ndarray | None] | None#
Detect payload in image using color thresholding.
- Parameters:
image (np.ndarray) – Input BGR image.
lower_pink (np.ndarray) – Lower HSV threshold for pink marker.
upper_pink (np.ndarray) – Upper HSV threshold for pink marker.
lower_green (np.ndarray) – Lower HSV threshold for green payload.
upper_green (np.ndarray) – Upper HSV threshold for green payload.
- Returns:
A tuple (cx, cy, visualization_image) if detection is successful; otherwise, None.
- Return type:
Optional[Tuple[int, int, np.ndarray | None]]
- compute_3d_vector(x: float, y: float, camera_info: numpy.ndarray, altitude: float, offset_x: float = 0, offset_y: float = 0, offset_z: float = 0) Tuple[float, float, float]#
Convert pixel coordinates to a 3D direction vector.
- image#