Creates matrix from carla transform.
(self, transform)
| 773 | return sensor_cords |
| 774 | |
| 775 | def get_matrix(self, transform): |
| 776 | """ |
| 777 | Creates matrix from carla transform. |
| 778 | """ |
| 779 | |
| 780 | rotation = transform.rotation |
| 781 | location = transform.location |
| 782 | c_y = np.cos(np.radians(rotation.yaw)) |
| 783 | s_y = np.sin(np.radians(rotation.yaw)) |
| 784 | c_r = np.cos(np.radians(rotation.roll)) |
| 785 | s_r = np.sin(np.radians(rotation.roll)) |
| 786 | c_p = np.cos(np.radians(rotation.pitch)) |
| 787 | s_p = np.sin(np.radians(rotation.pitch)) |
| 788 | matrix = np.matrix(np.identity(4)) |
| 789 | matrix[0, 3] = location.x |
| 790 | matrix[1, 3] = location.y |
| 791 | matrix[2, 3] = location.z |
| 792 | matrix[0, 0] = c_p * c_y |
| 793 | matrix[0, 1] = c_y * s_p * s_r - s_y * c_r |
| 794 | matrix[0, 2] = -c_y * s_p * c_r - s_y * s_r |
| 795 | matrix[1, 0] = s_y * c_p |
| 796 | matrix[1, 1] = s_y * s_p * s_r + c_y * c_r |
| 797 | matrix[1, 2] = -s_y * s_p * c_r + c_y * s_r |
| 798 | matrix[2, 0] = s_p |
| 799 | matrix[2, 1] = -c_p * s_r |
| 800 | matrix[2, 2] = c_p * c_r |
| 801 | return matrix |
| 802 | |
| 803 | def _change_seg_tl(self, seg_img, depth_img, traffic_lights, _region_size=4): |
| 804 | """Adds 3 traffic light classes (green, yellow, red) to the segmentation image |
no outgoing calls
no test coverage detected