这是LoG过滤的公式: alt text http://homepages.inf.ed.ac.uk/rbf/HIPR2/eqns/eqnlog2.gif
同样在使用LoG过滤的应用程序中,我看到只使用一个参数调用该函数:sigma(σ).我想尝试使用该公式进行LoG过滤(之前的尝试是通过高斯滤波器,然后是laplacian滤波器,带有一些滤波器窗口大小)但是看看那个公式我无法理解滤波器的大小如何与这个公式相关联,是吗?意味着过滤器尺寸是固定的?你能解释一下如何使用它吗?
filtering image-processing gaussian laplacian laplacianofgaussian
我正在寻找高斯边缘检测拉普拉斯的等效实现.
在matlab中我们使用以下函数
[BW,threshold] = edge(I,'log',...)
Run Code Online (Sandbox Code Playgroud)
在python中存在用于计算高斯拉普拉斯函数的函数.它没有明确地给予边缘.
scipy.ndimage.filters.gaussian_laplace
Run Code Online (Sandbox Code Playgroud)
任何指向在线实现或代码的指针
谢谢
python image-processing edge-detection imagefilter laplacianofgaussian
提供以下代码(被要求删除链接).但我想知道它是如何工作的.如果这被认为是边缘检测或斑点检测,我很困惑,因为维基百科将高斯拉普拉斯(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
我在实现LoG内核时遇到了麻烦.我正在尝试使用theta = 1.4实现9x9内核,如此链接http://homepages.inf.ed.ac.uk/rbf/HIPR2/log.htm所示.
但是,我对配方本身有困难.如果有人能告诉我如何计算中心,即为了在9x9内核中获得-40而使用的x和y值,我们将不胜感激.
我需要仅使用我的方法以及 matplotlib OpenCV 和 NumPy 构建 LoG 文件管理器(而不是仅使用过滤器来帮助计算的内置函数)
def edgeDetectionZeroCrossingLOG(img: np.ndarray) -> (np.ndarray):
"""
Detecting edges using the "ZeroCrossingLOG" method
:param I: Input image
:return: :return: Edge matrix
"""
kernel = np.ndarray((3, 3))
b_img = blurImage1(img, kernel)
k = np.array([[0, 1, 0],
[1, -4, 1],
[0, 1, 0]])
img_dervative = conv2D(img, k)
***Zero-Crossing***
Run Code Online (Sandbox Code Playgroud)
脚步:
def blurImage1(in_image: np.ndarray, kernel_size: np.ndarray) -> np.ndarray:
"""
Blur an image using a Gaussian kernel
:param inImage: Input image
:param kernelSize: Kernel size
:return: The …Run Code Online (Sandbox Code Playgroud) 我目前正在优化代码以提高图像处理效率。我的第一个问题是,由于vision.VideoFileReader和step地方花了很长时间才能打开每一帧。我通过将灰度图像压缩为1 RGB帧中的3帧来加快代码速度。这样,我可以使用加载1个RGB帧,vid.step()并导入3帧准备进行处理。
现在,我的代码在高斯的拉普拉斯算子(LoG)过滤上运行缓慢。我读到可以使用该函数imfilter执行LoG,但这似乎是下一个速率限制步骤。
进一步阅读后,看来imfilter速度不是最佳选择。显然,MATLAB引入了LoG函数,但它是在R2016b中引入的,不幸的是我正在使用R2016a。
有没有一种方法可以加快速度,imfilter或者有更好的功能可以用来执行LoG过滤?
我应该打电话给python来加快这个过程吗?
码:
Hei = gh.Video.reader.info.VideoSize(2);
Wid = gh.Video.reader.info.VideoSize(1);
Log_filter = fspecial('log', filterdot, thresh); % fspecial creat predefined filter.Return a filter.
% 25X25 Gaussian filter with SD =25 is created.
tic
ii = 1;
bkgd = zeros(Hei,Wid,3);
bkgd(:,:,1) = gh.Bkgd;
bkgd(:,:,2) = gh.Bkgd;
bkgd(:,:,3) = gh.Bkgd;
bkgdmod = reshape(bkgd,720,[]);
while ~isDone(gh.Video.reader)
frame = gh.readFrame();
img_temp = double(frame);
img_temp2 = reshape(img_temp,720,[]); …Run Code Online (Sandbox Code Playgroud) optimization matlab filtering image-processing laplacianofgaussian
filtering ×3
python ×3
gaussian ×1
imagefilter ×1
laplacian ×1
matlab ×1
opencv ×1
optimization ×1