Global Gradient-Based Phase Unwrapping Algorithm for Increased Performance in Wavefront Sensing