# How to choose the size of a Laplacian of Gaussian kernel for filtering images fast?

I am filtering an image using a Laplacian of Gaussian (LoG) kernel. The kernel dimensions are the same as the image. The filter operation takes very long to complete. How can I speed this up while maintaining fidelity?

The LoG kernel is not separable like the Gaussian kernel. So I cannot speed it up by filtering the image with 2 vectors successively. The only other option is to resize the kernel to get rid of insignificant multipliers on the outside. Is there a rule of thumb when choosing the size of an LoG kernel (considering image size and standard deviation of LoG)?

I am using this picture (633x900):

Filtering this in matlab using Gaussian vs. LoG gives vastly different times with the same kernel size:

>> I = imread('PICTURE.jpg');

>> tic;imfilter(double(I), fspecial('gaussian', [633,900], 50)); toc
Elapsed time is 1.129423 seconds.

>> tic;imfilter(double(I), fspecial('log', [633,900], 50)); toc
Elapsed time is 253.447840 seconds.


I just started with image processing so please excuse me if I missed out on something glaringly obvious. Thanks!

• Pay attention that the filter size doesn't have to be the size of the image. – Royi May 11 '18 at 20:44