Returns a dict of all 2d boundingboxes given a camera position, affordances and 3d bbs Args: seg_cam ([type]): [description] affordances ([type]): [description] bb_3d ([type]): [description] Returns: [type]: [description]
(self, seg_cam, affordances, bb_3d, seg_img)
| 426 | return bounding_boxes |
| 427 | |
| 428 | def _get_2d_bbs(self, seg_cam, affordances, bb_3d, seg_img): |
| 429 | """Returns a dict of all 2d boundingboxes given a camera position, affordances and 3d bbs |
| 430 | |
| 431 | Args: |
| 432 | seg_cam ([type]): [description] |
| 433 | affordances ([type]): [description] |
| 434 | bb_3d ([type]): [description] |
| 435 | |
| 436 | Returns: |
| 437 | [type]: [description] |
| 438 | """ |
| 439 | |
| 440 | bounding_boxes = { |
| 441 | "traffic_light": list(), |
| 442 | "stop_sign": list(), |
| 443 | "vehicles": list(), |
| 444 | "pedestrians": list() |
| 445 | } |
| 446 | |
| 447 | |
| 448 | if affordances['stop_sign']: |
| 449 | baseline = self._get_2d_bb_baseline(self._target_stop_sign) |
| 450 | bb = self._baseline_to_box(baseline, seg_cam) |
| 451 | |
| 452 | if bb is not None: |
| 453 | bounding_boxes["stop_sign"].append(bb) |
| 454 | |
| 455 | if affordances['traffic_light'] is not None: |
| 456 | baseline = self._get_2d_bb_baseline(self._vehicle.get_traffic_light(), distance=8) |
| 457 | |
| 458 | tl_bb = self._baseline_to_box(baseline, seg_cam, height=.5) |
| 459 | |
| 460 | if tl_bb is not None: |
| 461 | bounding_boxes["traffic_light"].append({ |
| 462 | "bb": tl_bb, |
| 463 | "state": self._translate_tl_state(self._vehicle.get_traffic_light_state()) |
| 464 | }) |
| 465 | |
| 466 | for vehicle in bb_3d["vehicles"]: |
| 467 | |
| 468 | trig_loc_world = self._create_bb_points(vehicle).T |
| 469 | cords_x_y_z = self._world_to_sensor(trig_loc_world, self._get_sensor_position(seg_cam), False) |
| 470 | |
| 471 | cords_x_y_z = np.array(cords_x_y_z)[:3, :] |
| 472 | veh_bb = self._coords_to_2d_bb(cords_x_y_z) |
| 473 | |
| 474 | if veh_bb is not None: |
| 475 | if np.any(seg_img[veh_bb[0][1]:veh_bb[1][1],veh_bb[0][0]:veh_bb[1][0]] == 10): |
| 476 | bounding_boxes["vehicles"].append(veh_bb) |
| 477 | |
| 478 | for pedestrian in bb_3d["pedestrians"]: |
| 479 | |
| 480 | trig_loc_world = self._create_bb_points(pedestrian).T |
| 481 | cords_x_y_z = self._world_to_sensor(trig_loc_world, self._get_sensor_position(seg_cam), False) |
| 482 | |
| 483 | cords_x_y_z = np.array(cords_x_y_z)[:3, :] |
| 484 | |
| 485 | ped_bb = self._coords_to_2d_bb(cords_x_y_z) |
nothing calls this directly
no test coverage detected