import cv2
import numpy as np
img = cv2.imread("lena.jpg", 0)
x = cv2.Sobel(img,cv2.CV_16S,1,0)
y = cv2.Sobel(img,cv2.CV_16S,0,1)
absX = cv2.convertScaleAbs(x)
absY = cv2.convertScaleAbs(y)
resule = cv2.addWeighted(absX,0.5,absY,0.5,0) # result = 0.5x + 0.5y
请问为什么不是用均方根呢?
result_new = np.sqrt(x * x + y * y)
result_new = np.rint(result_new).astype(np.uint8)
cv2.imshow("new",result_new) # 出来结果不一致,好像是错误的