The far-field intensity is detected from far-field image to estimate the piston distance between two gratings. The image processing algorithm includes projections along the horizontal and vertical directions, search for each focal spot's centre, feature extraction and intensity computation. Each focal spot's centre can be found with the projections. A self-growing method is used for feature extraction, where the threshold value depends on the gray value of each focal spot's centre. For each focal spot, the sum of gray values within the relevant domain is taken to be its energy intensity. Furthermore, the energy ratio of left and main focal spots (or main and right focal spots) is computed. A formula that expresses the piston distance between two gratings as the function of the energy ratio is fitted with several measured points. Based on this formula, the piston distance is obtained for a new energy-ratio. Finally, the proposed method is verified with a series of experiments.