1. An image forming apparatus for forming an image of an object to be inspected using return light from the object to be inspected which is irradiated with measurement light via a scanner, the image forming apparatus comprising: a signal detecting unit for detecting signals output from the scanner which is set to scan the object to be inspected with the measurement light at a first frequency; a determining unit for determining a second frequency which is estimated to be used for the scanning by the scanner, by comparing a first correlation between the detected signals and signals obtained by shifting the detected signals by a cycle of the first frequency, with a second correlation between the detected signals and signals obtained by shifting the detected signals by a cycle of a different frequency different from the first frequency; and an image forming unit for forming the image of the object to be inspected using (1) the determined second frequency and (2) the return light from the object to be inspected which is irradiated with the measurement light via the scanner.