a computer implemented software device for estimating background tilt and offset is disclosed to preferably be adaptable to an optical measurement instrument wherein the estimated parameters are resolved to generate a reference plane to be subtracted from a height map of a phase profile . a set of histograms of heights is used to develop a merit function . a two - dimensional high speed iterative search is used to optimize the merit function to generate a reference plane coincident with the spatial tilt of the phase profile . the invention enables real - time measurement of substrate height for preferred use in high - speed image processing operations relating to circuit - board production lines .