Fast convolution of an large image and small mask
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Happy PhD
am 8 Aug. 2018
Bearbeitet: Happy PhD
am 15 Aug. 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.
0 Kommentare
Akzeptierte Antwort
Naman Chaturvedi
am 13 Aug. 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.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!