A geometric method for computing a camera's interior parameters and exterior parameters is presented based on a perspective image. According to the geometric relation of the vanishing points, three vanishing points can be calculated from single perspective image. Then the camera's relative position and orientation can be achieved using the perspective projection theory of vanishing points. Meanwhile, the camera's real position and the rectangular vertices in 3D space can be recovered if the edge lengths of the rectangle are known. Finally, the effective focal length can be drawn in terms of the perspective projection. This method is simple and easy to be implemented. Extensive simulations as well as real experiments show that this method has merits of high precision and strong robustness.