The key of autonomous underwater vehicle to perform a variety of missions in complex sea environment was to accurately distinguish obstacle and mapping in real time. In this paper, the information of obstacle was segmented from sonar image by image filter, image enhancement, fuzzy clustering algorithm and morphology method. Then the coordinate system was established, the barrier information of each frame was projected onto the entire barrier map. Finally, the experiment on the lake proves that the methods of the image processing and mapping algorithm are feasibility.