Transmission electron microscopy, as most imaging devices, introduces optical aberrations that in the case of thin specimens are usually modeled in Fourier space by the so-called contrast transfer function (CTF). Accurate determination of the CTF is crucial for its posterior correction. Furthermore, the CTF estimation must be fast and robust if high-throughput three-dimensional electron microscopy (3DEM) studies are to be carried out. In this paper we present a robust algorithm that fits a theoretical CTF model to the power spectrum density (PSD) measured on a specific micrograph or micrograph area. Our algorithm is capable of estimating the envelope of the CTF which is absolutely needed for the correction of the CTF amplitude changes.