1. Field of the Invention
The present invention relates to a distance-measuring apparatus for measuring the distance to a target object using a phase difference sensor, a distance-measuring method, and a recording medium.
2. Description of the Related Art
When a projecting apparatus (projector) projects an image on a screen, the image might be distorted like a trapezoid depending on how the projector is disposed with respect to the screen.
As a method of correcting the distortion of a projected image automatically, the following is performed. The distance from a projection optical system to a screen is measured at three or more points. On the basis of a phase difference among the distances to the three points, the inclination angle of the projection plane of the screen is detected, and the distortion of an image projected on the plane is corrected (see Jpn. Pat. Appln. KOKAI Publication No. 2005-006228, for example).
Measuring the distance to a target object is called “distance measurement”. Correcting the distortion of a projected image on the basis of the result of the distance measurement is called “trapezoid correction” because the image is distorted like a trapezoid.
A phase-difference sensor that is commonly used as a distance-measuring sensor in a projector and the like is sometimes changed in shape with time under the influence of ambient temperature, heat of a light source, etc. Though the change in shape is very small, it has a great influence on measurement precision because the size of the sensor itself is small.
A technique of reducing an error in measurement using a phase difference sensor in a prior art projector is disclosed in Jpn. Pat. Appln. KOKAI Publication No. 2005-061925.
Publication No. 2005-061925 discloses that a chart image (pattern image for distance measurement) is shifted a plurality of times and projected to measure the distance to a target object and the results of a plurality of measurements are averaged. However, the technique is a method of reducing an error by a plurality of measurements, and cannot cancel an error in measurement due to a change in the shape of the phase difference sensor itself.
Jpn. Pat. Appln. KOKAI Publication No. 2005-307934 discloses a camera using a phase difference sensor.
The camera of Publication No. 2005-307934 has a function of detecting an external factor in inhibiting measurement and a function of promoting the necessity of remeasurement. If an image is picked up with the phase difference sensor covered with an operator's finger, a warning is given to the operator. However, this warning shows only the incapability of measurement. As in the case of Publication No. 2005-061925, Publication No. 2005-307934 cannot cancel an error in measurement due to a change in the shape of the phase difference sensor itself.
As described above, a projector measures the distance to a screen at a plurality of points using a phase difference sensor and computes the inclination angle of the screen from distance data of these points. The inclination angle of the screen, for example, in the horizontal direction is computed by the ratio between the distances to right and left two points. However, due to variations in the characteristics of the phase difference sensor, the ratio comes to include an error as the phase difference sensor changes in shape with time. This error has an influence upon the detection of the inclination angle and consequently the reliability of trapezoid correction will be decreased.