7.10.3. object_detector.visualize_rois

object_detector.visualize_rois(image, rois, class_names, scale=2)

Visualizes the bounding boxes on the image.

Visualizes the bounding boxes on the image. The bounding boxes are visualized by drawing a rectangle around each object. The class name of each object is also displayed above the bounding box.

Parameters:
  • image (np.ndarray) – The image on which the bounding boxes are visualized.

  • rois (List[sensor_msgs.msg.RegionOfInterest]) – List of bounding boxes for each detected object.

  • class_names (List[str]) – List of class names for each detected object.

  • scale (int) – Scale factor for the image. The image is resized by this factor before visualizing the bounding boxes. This is used to make the labeled text more readable (since it has more pixels).

Returns:

The image with the bounding boxes visualized.

Return type:

np.ndarray