Grid fitting: Next, we iteratively fit a grid to the extrema that survived
the pruning stage. We must cope with noise that still remains
in the extrema location, and with erroneous extrema that survived
the pruning (e.g., in a gap between nearby black lines). Furthermore,
we must be able to handle not perfectly regular grids, since
smooth deformations occur across the paper due to imperfect printing and scanning. Finally, the grids are not complete, since there
may be large white or black regions.
To overcome these difficulties, we use a parametric model for the
grid that explicitly incorporates a smooth deformation field, and
formulate the fitting as an energy minimization problem. Given a
current guess for the parameters of the grid and its deformation field
we seek to optimize the following high level goals: