Fast convolution of an large image and small mask

2 visualizzazioni (ultimi 30 giorni)
Hi, I was wondering if it is possile to speed up the convolution of a large image? My image and my mask are not the same size. For example my image has the size 1430 x 1340 (I cut it down a bit) and my mask is 56 x 56. My mask is an aperture of a certain size.
When the blob in my image is very large (covers large part of the image), conv2 and imfilter is taking a very long time. fft2, only works for images of the same size?
Edit: removed code.
Help, I dont have the time to wait 30+ min for each simulation. I need to speed up the convolution somehow? Any idea of how to make this faster?
The idea is to determine how much energy we have in the aperture of certain size (my mask) and find the maximal energy output in my blob. The Aperture is not always circular.

Risposta accettata

Naman Chaturvedi
Naman Chaturvedi il 13 Ago 2018
Hi,
A possible solution to the problem can be to zero pad the mask image, find its fft using 'fft2', multiply it with the image's fft and find the ifft using 'ifft2'. So, if 'm' is your mask and 'i' your image, you could zeros pad the mask 'm':
M=zeros(size(i));
M(1:size(m,1),1:size(m,2))=m;
M=uint8(M);
You can proceed further by treating fft of M as your fft of original mask m.

Più risposte (0)

Categorie

Scopri di più su Image Processing Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by