PTZ (Pan-Tilt-Zoom) cameras are widely used for large-area video surveillance. For many visual tracking and video analysis tasks, an accurate camera calibration is very important. Traditional off-line camera calibration algorithms are often not satisfactory because some of the PTZ camera intrinsic parameters (e.g., focal length) may change during working. Despite of their theoretical elegance, existing on-line camera self-calibration algorithms are not satisfactory either, because of the lack of numerical stability. This paper proposes a new method based on LMI (linear matrix inequality) optimization. This method automatically incorporates the required positive-definiteness constraint into the computation, thus delivers more reliable and more stable results. Experiments on both synthetic data and real images have validated the advantages of our method.