Abstract: The present invention allows for calibration of a scanning probe microscope under computer control. The present invention comprehends either the removal of nonlinear artifacts in the microscope output data after measurement has been taken (a off-line process), or the correction of nonlinear movements in the microscope scanner such that the scanner moves in a linear fashion during measurement (a realtime process). The realtime process may be operated in both an open-loop and a closed-loop process. The processes of the present invention uses an average cross-section of the scan in order to simplify the calculation and to improve the signal-to-noise ratio. Interpolation methods and centroid calculations are used to locate features on the scanned sample to subpixel precision.