In order to improve the training efficiency of table tennis players, many robots have been applied to various physical training scenarios. Among all these studies, the ball picking robot can save players time for picking up the ball and avoid fatigue caused by bending. However, a table tennis picking robot needs to know where it is, where the ball is, and where the table is. In this way, the mobile robot can move towards the ball, pick it up, and return to the table. In this paper, we propose an approach to solve all these problems by using an RGB-D camera and YOLOv8 object detection model. Firstly, the mobile robot is steered to build an occupancy grid map of the table area. Then, based on the known robot pose, the mobile robot moves towards an assigned position, captures an image from the direction. Sift features are extracted and saved as the reference map. Finally, during the usage phase, the mobile robot localizes itself according to the reference map, detects and recognizes a table tennis on the ground, moves to grab the ball, and returns to the table. The conducted experiment shows that our approach is effective and achieves better localization performance. Based on the localization information, the mobile robot moves through multitarget points along the planed route to detect the table tennis.