A new method for elliptical shape detection based on the principle of gray and mass moment preserving is proposed. For each elliptical region in a gray-scale image, automatic bilevel thresholding based on gray moment preserving is used first to transform the blurred image in the region into a binary picture. The five parameters of the elliptical shape are then computed using the mass moment preserving principle. A major merit of the method is that these parameters can be uniquely and analytically determined without iterative computation. By the proposed method, other shapes like rectangles, circles, semi-circle running tracks, etc. can also be detected. Experimental results show the effectiveness of the proposed method.