圖像像素梯度

# 編輯梯度損失函數 import numpy as np import matplotlib.pyplot as plt def grad(img): b, h, w, c = img.shape g_y=img[:,1:,:,:]-img[:,:-1,:,:] #計算高度方向梯度 g_x=img[:,:,1:,:]-img[:,:,:-1,:] #計算寬度方向梯度
相關文章
相關標籤/搜索