0
I_pad=np.pad(img0,1,'edge') #array padding

FY=np.gradient(I_pad,axis=0)
FX=np.gradient(I_pad,axis=1)


dx = np.abs(FY)/np.sqrt(FX**2+FY**2)
dy = np.abs(FX)/np.sqrt(FX**2+FY**2)

I am trying to avoid the RuntimeWarning: invalid value encountered in true_divide in NumPy. and unable to find a solution

0 Answers0