The skeleton of an image object is a simplified representation, which is of great significance for the image recognition and matching. To obtain a smooth and accurate skeleton of a specified object in the gray image, this paper provides a unified framework by combining the level set idea with the gradient module method. The intrinsic procedure involves three steps. First, an energy function is given by virtue of the statistical intensity disparity between the sample points and the object, and then a novel segmentation model is proposed to extract any specified objects in the gray image by the variational method. Moreover, the segmentation model is further improved to be suited to the texture image. Second, in order to find an accurate position of the skeleton, a searching algorithm for the endpoints of the skeleton is shown based on the segmentation result. Finally, an improved skeleton extraction algorithm is given via the shortest path connection approach. Some examples show the robustness and insensitivity of the presented algorithm to the perturbation and noise, respectively