(self)
coors_range = np.array(self.w_config.get("CoorsRange"), dtype=np.float32)
        bv_range = coors_range[[0, 1, 3, 4]]
        voxel_size = np.array(self.w_config.get("VoxelSize"), dtype=np.float32)
        grid_size = (coors_range[3:] - coors_range[:3]) / voxel_size
        grid_size = np.round(grid_size).astype(np.int64)

        foo_map_size = grid_size[:2]
        # foo_map_size = [200, 200]
        x = np.arange(foo_map_size[0])
        y = np.arange(foo_map_size[1])
        shift = coors_range[:2]
        x = x * voxel_size[0] + shift[0] + 0.5 * voxel_size[0]
        y = y * voxel_size[1] + shift[1] + 0.5 * voxel_size[1]
        xy1, xy2 = np.meshgrid(x, y)
        
        def gaussian2d(x, y, A, ux=0, uy=0, stdx=1, stdy=1):
            return A * np.exp(-0.5 * ((x - ux) / stdx) ** 2 - 0.5 * ((y - uy) / stdy) ** 2)
        z = gaussian2d(xy1, xy2, 0, 0, 2, 2) - 20
        self.w_pc_viewer.surface("test", x, y, z, GLColor.Purple, 0.5)
coors_range = np.array(self.w_config.get("CoorsRange"), dtype=np.float32)
        bv_range = coors_range[[0, 1, 3, 4]]
        voxel_size = np.array(self.w_config.get("VoxelSize"), dtype=np.float32)
        grid_size = (coors_range[3:] - coors_range[:3]) / voxel_size
        grid_size = np.round(grid_size).astype(np.int64)
coors_range = np . array ( self . w_config . get ( CoorsRange ) dtype = np . float32 ) bv_range = coors_range [[ 0 1 3 4 ]] voxel_size = np . array ( self . w_config . get ( VoxelSize ) dtype = np . float32 ) grid_size = ( coors_range [ 3 : ] - coors_range [ : 3 ] ) / voxel_size grid_size = np . round ( grid_size ) . astype ( np . int64 )
def plot_pointcloud(self):
        if self.kitti_info is None:
            self.error("you must load infos and choose a existing image idx first.")
            return
        pc_info = self.kitti_info["point_cloud"]
        image_info = self.kitti_info["image"]

        point_color = self.w_config.get("PointColor")[:3]
        point_color = (*point_color, self.w_config.get("PointAlpha"))
        point_color = np.tile(np.array(point_color), [self.points.shape[0], 1])

        # self.w_pc_viewer.reset_camera()
        point_size = np.full(
            [self.points.shape[0]],
            self.w_config.get("PointSize"),
            dtype=np.float32)
        # self.w_pc_viewer.draw_point_cloud(self.points, color=points_rgb, with_reflectivity=False, size=0.1)
        # self.w_pc_viewer.draw_bounding_box()
        idx = self.image_idxes.index(image_info["image_idx"])
        if 'annos' in self.kitti_info:
            # poses = np.zeros([self.gt_boxes.shape[0], 3])
            # self.w_pc_viewer.circles(
            #     "circles", poses, np.linalg.norm(
            #         self.gt_boxes[:, :3], axis=-1))
            # self.w_pc_viewer.draw_anchors_trunk(
            #     self.gt_boxes, self.points, gt_names=gt_names)
            # self.w_pc_viewer.draw_anchors_v1(
            #     self.gt_boxes, self.points, gt_names=gt_names)
            # self.w_pc_viewer.draw_frustum(bboxes, rect, Trv2c, P2)
            # self.w_pc_viewer.draw_cropped_frustum(bboxes, rect, Trv2c, P2)
            gt_point_mask = box_np_ops.points_in_rbbox(self.points,
                                                       self.gt_boxes).any(1)
            point_size[gt_point_mask] = self.w_config.get("GTPointSize")
            gt_point_color = self.w_config.get("GTPointColor")
            gt_point_color = (*gt_point_color[:3],
                              self.w_config.get("GTPointAlpha"))
            point_color[gt_point_mask] = gt_point_color
        self.w_pc_viewer.remove("dt_boxes/labels")
        self.w_pc_viewer.remove("dt_boxes")
        if self.detection_annos is not None and self.w_config.get("DrawDTBoxes"):
            detection_anno = self.detection_annos[idx]
            self.draw_detection(detection_anno)
        if self.w_config.get("WithReflectivity"):
            if self.points.shape[1] < 4:
                self.error("Your pointcloud don't contain reflectivity.")
            else:
                point_color = np.concatenate(
                    [point_color[:, :3], self.points[:, 3:4] * 0.8 + 0.2],
                    axis=1)

        self.w_pc_viewer.scatter(
            "pointcloud", self.points[:, :3], point_color, size=point_size)
        """
        coors_range = np.array(self.w_config.get("CoorsRange"), dtype=np.float32)
        bv_range = coors_range[[0, 1, 3, 4]]
        voxel_size = np.array(self.w_config.get("VoxelSize"), dtype=np.float32)
        grid_size = (coors_range[3:] - coors_range[:3]) / voxel_size
        grid_size = np.round(grid_size).astype(np.int64)

        foo_map_size = grid_size[:2]
        # foo_map_size = [200, 200]
        x = np.arange(foo_map_size[0])
        y = np.arange(foo_map_size[1])
        shift = coors_range[:2]
        x = x * voxel_size[0] + shift[0] + 0.5 * voxel_size[0]
        y = y * voxel_size[1] + shift[1] + 0.5 * voxel_size[1]
        xy1, xy2 = np.meshgrid(x, y)
        
        def gaussian2d(x, y, A, ux=0, uy=0, stdx=1, stdy=1):
            return A * np.exp(-0.5 * ((x - ux) / stdx) ** 2 - 0.5 * ((y - uy) / stdy) ** 2)
        z = gaussian2d(xy1, xy2, 0, 0, 2, 2) - 20
        self.w_pc_viewer.surface("test", x, y, z, GLColor.Purple, 0.5)
        """
def plot_pointcloud ( self ) : if self . kitti_info is None : self . error ( "you must load infos and choose a existing image idx first." ) return pc_info = self . kitti_info [ "point_cloud" ] image_info = self . kitti_info [ "image" ] point_color = self . w_config . get ( "PointColor" ) [ : 3 ] point_color = ( * point_color , self . w_config . get ( "PointAlpha" ) ) point_color = np . tile ( np . array ( point_color ) , [ self . points . shape [ 0 ] , 1 ] ) # self.w_pc_viewer.reset_camera() point_size = np . full ( [ self . points . shape [ 0 ] ] , self . w_config . get ( "PointSize" ) , dtype = np . float32 ) # self.w_pc_viewer.draw_point_cloud(self.points, color=points_rgb, with_reflectivity=False, size=0.1) # self.w_pc_viewer.draw_bounding_box() idx = self . image_idxes . index ( image_info [ "image_idx" ] ) if 'annos' in self . kitti_info : # poses = np.zeros([self.gt_boxes.shape[0], 3]) # self.w_pc_viewer.circles( #     "circles", poses, np.linalg.norm( #         self.gt_boxes[:, :3], axis=-1)) # self.w_pc_viewer.draw_anchors_trunk( #     self.gt_boxes, self.points, gt_names=gt_names) # self.w_pc_viewer.draw_anchors_v1( #     self.gt_boxes, self.points, gt_names=gt_names) # self.w_pc_viewer.draw_frustum(bboxes, rect, Trv2c, P2) # self.w_pc_viewer.draw_cropped_frustum(bboxes, rect, Trv2c, P2) gt_point_mask = box_np_ops . points_in_rbbox ( self . points , self . gt_boxes ) . any ( 1 ) point_size [ gt_point_mask ] = self . w_config . get ( "GTPointSize" ) gt_point_color = self . w_config . get ( "GTPointColor" ) gt_point_color = ( * gt_point_color [ : 3 ] , self . w_config . get ( "GTPointAlpha" ) ) point_color [ gt_point_mask ] = gt_point_color self . w_pc_viewer . remove ( "dt_boxes/labels" ) self . w_pc_viewer . remove ( "dt_boxes" ) if self . detection_annos is not None and self . w_config . get ( "DrawDTBoxes" ) : detection_anno = self . detection_annos [ idx ] self . draw_detection ( detection_anno ) if self . w_config . get ( "WithReflectivity" ) : if self . points . shape [ 1 ] < 4 : self . error ( "Your pointcloud don't contain reflectivity." ) else : point_color = np . concatenate ( [ point_color [ : , : 3 ] , self . points [ : , 3 : 4 ] * 0.8 + 0.2 ] , axis = 1 ) self . w_pc_viewer . scatter ( "pointcloud" , self . points [ : , : 3 ] , point_color , size = point_size )