One of the problems in using head-mounted displays (HMDs) is that the virtual images shown through the HMDs are usually distorted due to their optical distortions. In order to correctly compensate the optical distortions through a pre distortion technique, accurate values of the distortion parameters are required. Although several distortion calibration methods have been developed in prior work, these methods suffer a few critical limitations. In this paper, we proposed a method for robustly estimating the optical distortion parameters of both immersive and (optical) see-through HMDs, without the limitations of existing methods. The proposed method is based on photogrammetry and considers not only the radial distortion but also the tangential distortion. Its effectiveness was evaluated through an experiment conducted with two different types of HMDs, an optical see-through head-mounted projection display and a commercially available non-see-through HMD. According to the experimental results, the proposed method showed significantly lower reprojection error than a previous method proposed by Owen et al. In addition, when both the radial and tangential distortions were considered, the proposed method was significantly more effective than when only the radial distortion was considered.