Aiming at the problem that the large amount of environmental perception calculation affects the walking efficiency in the rover detection task of celestial bodies outside the earth, the scheme selection, the parallel optimization engineering design and the efficient hardware implementation of stereo vision algorithm were proposed. Through the optimization design of algorithms suitable for parallel implementation, such as one-time look-up table of forward camera model, omitting redundant calculation, 3D point cloud generation and fast filtering, the amount of calculation for stereo vision was significantly reduced. Through the parallel implementation of hardware, the perception efficiency was improved by 8 times compared with that of “Yutu 2” Lunar rover. “Zhurong” Mars rover extensively used the algorithm for autonomous obstacle avoidance and completed a safe and efficient 1km-distance walk. The flight verification results show that the design is safe and effective under unknown environments and resource constraints of celestial bodies outside the earth, and can be used as the cornerstone of subsequent deep space missions.