Fast convolution of an large image and small mask

2 visualizaciones (últimos 30 días)
Happy PhD
Happy PhD el 8 de Ag. de 2018
Editada: Happy PhD el 15 de Ag. de 2018
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.

Respuesta aceptada

Naman Chaturvedi
Naman Chaturvedi el 13 de Ag. de 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.

Más respuestas (0)

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by