This paper presents a distance measurement method based on pixel number variation of CCD images by referencing to two arbitrarily designated points in the image frames. By establishing a relationship between the displacement of the camera movement along the photographing direction and the difference in pixel count between reference points in the images, the distance from an object can be calculated via the proposed method. To integrate the measuring functions into digital cameras, a circuit design implementing the proposed measuring system in selecting reference points, measuring distance, and displaying measurement results on CCD panel of the digital camera is proposed in this paper. In comparison to pattern recognition or image analysis methods, the proposed measuring approach is simple and straightforward for practical implementation into digital cameras. To validate the performance of the proposed method, measurement results using the proposed method and ultrasonic rangefinders are also presented in this paper.