Based on the research background of in situ automatic ultrasonic phased array inspection of irregular porous castings, due to the limited in situ inspection stations, complex shape of irregular porous castings, and extreme multireflection structural features, it is necessary to identify the positioning inspection features among multiple features to be inspected and plan the optimal inspection path. This research is interested in the porous location recognition and its detection path planning of irregular porous castings. For this, a point cloud-based multifeature contour recognition and location algorithm were proposed to simultaneously extract and locate the hole feature and cylindrical feature from an irregular porous castings. Furthermore, a detection path planning method was put forward to search the shortest robot’s detection path based on the above acquired features by visual recognition and positioning technology. First, through the calibration of the industrial robot tool coordinate system and the internal and external parameters of the camera, the “EyeinHand” hand-eye conversion relationship was established. Second, the robot vision system collects the point cloud information of the area to be inspected and performs point cloud splicing, the accuracy of the original data, the removal of noise such as invalid points, outliers and internal noise points, on this basis, the boundary curve of the hole to be inspected was extracted, the cylindrical equation was fitted, its geometric center was calculated, and the central coordinates and axis direction of the contour of the hole to be inspected were obtained. Finally, all the detection paths were traversed through the multibranch tree to obtain the optimal detection path of the detection points of multiple targets. The experimental results show that the positioning accuracy of the feature of the hole to be inspected by the vision system is 0.107 mm, the aperture extraction accuracy is 0.002 mm, the cylinder fitting accuracy is 0.04 mm, and the calculation accuracy of the angle between the two axes is within 0.4. When the number of features to be inspected is different, the average moving distance can be saved by 10.7% by using the end effector after path optimization. The feasibility of in situ automatic ultrasonic phased array detection for irregular porous castings using by visual positioning is verified.