conversations.py
Go to the documentation of this file.
1 import numpy as np
2 
3 
4 def rects_msg_to_ndarray(rects_msg):
5  rects = np.zeros((len(rects_msg.rects), 4), dtype=np.float32)
6  for i, r in enumerate(rects_msg.rects):
7  xmin = r.x
8  ymin = r.y
9  xmax = r.x + r.width
10  ymax = r.y + r.height
11  rects[i] = [xmin, ymin, xmax, ymax]
12  return rects
13 
14 
16  center_x = bbox_msg.pose.position.x
17  center_y = bbox_msg.pose.position.y
18  center_z = bbox_msg.pose.position.z
19  dim_x = bbox_msg.dimensions.x
20  dim_y = bbox_msg.dimensions.y
21  dim_z = bbox_msg.dimensions.z
22  x1 = center_x - dim_x / 2.
23  x2 = center_x + dim_x / 2.
24  y1 = center_y - dim_y / 2.
25  y2 = center_y + dim_y / 2.
26  z1 = center_z - dim_z / 2.
27  z2 = center_z + dim_z / 2.
28  return x1, y1, z1, x2, y2, z2


jsk_recognition_utils
Author(s):
autogenerated on Tue Mar 3 2020 03:59:38