In this paper, we present a method to recover the complex amplitude of speckle fields from measurements performed by a shear interferometer. It is based on the optimization of an objective function using the steepest descent gradient technique in combination with a heuristic initial guess. In contrast to already existing methods, the algorithm finds a local minimum least-squares solution even in the presence of Poissonian and Gaussian noise.