To meet the necessity of fast vision process in four-legged league of RoboCup, this paper presents a vision-based fast method of objects recognition and distances calculation. The image is segmented online according to the threshold obtained offline by applying OPENCV offered by Intel Corporation. By the use of a tree-based union find with path compression, a merging method is implemented to find the regions and to find the objects. According to the camera model, the distances between objects and robots are calculated by the inverse transformation from two dimensions to three dimensions. The experimental result shows the validity.