Celestial body features are important navigation information in deep space exploration. This study provides a synchronous high-precision extraction algorithm for star centroid and nearby celestial body edges for a miniaturized independent optical navigation sensor, which combines the functions of a star tracker and a navigation camera. The image is filtered by a ring filter template to eliminate the interference information of background and improve the contrast between the target and the background. The secondorder directional derivative and specific area characteristic method aim to roughly extract and distinguish the features (star centroid and the nearby celestial body edge). In local area template where feature points are located, the 1D energy deviation effect is proposed to extract the features of the two different light intensity distribution models. The accuracy and robustness of our algorithm are verified by simulation and groundbased experiments. The algorithm has certain reference significance for other types of dim target and edge detections, such as infrared detection, medical image, target measurement, and machine vision. INDEX TERMS Optical autonomous navigation, high robustness and accuracy, star centroid, nearby celestial body edge, 1D energy deviation effect. GUANGJUN ZHANG received the Ph.D. degree from the