Overview
Visualizes the anchor points used by the trigger strategy system to determine if detections are within zones or crossing lines. Each anchor point is drawn as a small filled circle at the calculated position on the bounding box. Supports drawing individual anchor points or multiple points simultaneously.Function Signature
Parameters
Input image to draw anchor points on in BGR format. Image is modified in-place.
Detection results containing bounding boxes. Each detection must have a ‘bbox’ attribute with (x1, y1, x2, y2) coordinates.
Strategy for determining anchor points to draw. Single string: “center”, “bottom_center”, “top_left”, etc. List of strings: Multiple anchor points. None draws all 9 main anchor points (center, corners, edge centers).
Radius of anchor point circles in pixels. If None, automatically scaled based on image size (minimum 2 pixels).
Thickness of circle outline in pixels. Use -1 for filled circles. If None, defaults to -1 (filled).
List of BGR color tuples for custom colors. Colors mapped to unique class_ids in order of appearance. If None, uses default ColorManager colors.
Returns
Image with anchor points drawn. The input image is modified in-place.
Examples
Error Handling
This function may raise the following exceptions:
- AttributeError: If detections don’t have required ‘bbox’ attribute.
- ValueError: If invalid strategy string is provided.
Notes
- Anchor points are calculated using the get_anchor_position function from strategies module
- Invalid anchor strategies are skipped gracefully to prevent errors
- Radius is automatically scaled with image size if not specified
- All 9 anchor points include: center, 4 corners, and 4 edge centers
- Colors are applied consistently across detections with the same class_id