1. A method comprising: receiving, by one or more processors, an input image; identifying, by the one or more processors, a plurality of objects in the input image; estimating, by the one or more processors, a local transformation matrix for each of the plurality of objects; calculating rectification parameters for the plurality of objects using the local transformation matrix; identifying, by the one or more processors, a plurality of candidate rectification parameters using a voting procedure on the rectification parameters for the plurality of objects; estimating, by the one or more processors, final rectification parameters based on the plurality of candidate rectification parameters; computing, by the one or more processors, a global transformation matrix using the final rectification parameters; and performing, by the one or more processors, image rectification on the input image using the global transformation matrix.