conversations.py
Go to the documentation of this file.
00001 import numpy as np
00002 
00003 
00004 def rects_msg_to_ndarray(rects_msg):
00005     rects = np.zeros((len(rects_msg.rects), 4), dtype=np.float32)
00006     for i, r in enumerate(rects_msg.rects):
00007         xmin = r.x
00008         ymin = r.y
00009         xmax = r.x + r.width
00010         ymax = r.y + r.height
00011         rects[i] = [xmin, ymin, xmax, ymax]
00012     return rects
00013 
00014 
00015 def bounding_box_msg_to_aabb(bbox_msg):
00016     center_x = bbox_msg.pose.position.x
00017     center_y = bbox_msg.pose.position.y
00018     center_z = bbox_msg.pose.position.z
00019     dim_x = bbox_msg.dimensions.x
00020     dim_y = bbox_msg.dimensions.y
00021     dim_z = bbox_msg.dimensions.z
00022     x1 = center_x - dim_x / 2.
00023     x2 = center_x + dim_x / 2.
00024     y1 = center_y - dim_y / 2.
00025     y2 = center_y + dim_y / 2.
00026     z1 = center_z - dim_z / 2.
00027     z2 = center_z + dim_z / 2.
00028     return x1, y1, z1, x2, y2, z2


jsk_recognition_utils
Author(s):
autogenerated on Tue Jul 2 2019 19:40:37