How to implement fast algorithm for convolution integrals with space and time variant kernels?

2 views (last 30 days)

I am trying to implement an algorithm that is described in this paper , which is for convolution integrals with space and time variant kernels. That is, if we have an integral of this form:

,where the $\sigma$ is a function of space, we cannot simply use the multiplication in Fourier space, and so we can approximate the kernel with a series of kernels with different widths, in this way:

So for a 2D field (matrix) $\sigma$, we calculate the approximation coefficient 2D fields $\alpha_l$ for a given set of fixed width of the kernels $\sigma_l$, using this formula:

The code I am using in `matlab` for now is the following:

    function alpha=calc_alpha(sigma,sigma_l)
    alpha = zeros(size(sigma,1),size(sigma,2),size(sigma_l,2));
    for i = (1:size(sigma_l,2))
        pre_alpha=(2*sigma.^2)./(sigma.^2 + sigma_l(i)^2);
        prod = ones(size(sigma));
        for j = (1:size(sigma_l,2))
            if j~=i
                prodA=(sigma.^2 - sigma_l(j)^2)/(sigma_l(i)^2 - sigma_l(j)^2);
                prodB=(sigma_l(i)^2 + sigma_l(j)^2)./(sigma.^2 + sigma_l(j)^2);
                prod = prod*prodA*prodB;
            end
        end
        disp(prod);
        alpha(:,:,i)=pre_alpha*prod;
    end
    end

Is a way to use broadcasting in order to speed up this kind of calculation by avoiding the for loops?

  1 Comment
Liang Zhang
Liang Zhang on 26 Aug 2020
Hello,
My name is ZhangLiang, and can I ask you a question?
The same with the article of your question.
After get and , then calculate the :
Apply the Fourier transformation makes it easier.
Could you tell me the details on calculte , with 2-D Gaussian kernel and 2-D grid space. I am troubled in get and , I do not know how to get that with a grid (just a 2-D matrix) space.
Can you give me some suggestions?
Thank you.

Sign in to comment.

Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!