提供以下代码(被要求删除链接).但我想知道它是如何工作的.如果这被认为是边缘检测或斑点检测,我很困惑,因为维基百科将高斯拉普拉斯(LoG)列为斑点检测.
此外,有人可以解释并提供更深层次的解释,说明为什么计算绝对值以及focus_stack()函数中发生了什么?
# Compute the gradient map of the image
def doLap(image):
# YOU SHOULD TUNE THESE VALUES TO SUIT YOUR NEEDS
kernel_size = 5 # Size of the laplacian window
blur_size = 5 # How big of a kernal to use for the gaussian blur
# Generally, keeping these two values the same or very close works well
# Also, odd numbers, please...
blurred = cv2.GaussianBlur(image, (blur_size,blur_size), 0)
return cv2.Laplacian(blurred, cv2.CV_64F, ksize=kernel_size)
#
# This …Run Code Online (Sandbox Code Playgroud) python opencv image-processing computer-vision laplacianofgaussian