// The actual image img is embedded into a larger image by
// adding vertical space on top and at the bottom (padding)
hpadding = r // this is large enough
padded = np.vstack([cval * np.ones((hpadding, w)), img, cval * np.ones((hpadding, w))])
center = center + hpadding
dewarped = [padded[center[i] - r:center[i]+r, i] for i in range(w)]
dewarped = np.array(dewarped, dtype=dtype).T
After Change
center = center + hpad - r
new_h = 2*r
dewarped = [padded[c:c+new_h, i] for i, c in enumerate(center)]
dewarped = np.swapaxes(np.array(dewarped, dtype=img.dtype), 1, 0)
return dewarped