MATLAB Answers

I want to multiply two matrices by sliding the smaller matrix on the larger one through neighborhood operations

7 views (last 30 days)
maaham banu
maaham banu on 10 Feb 2020
Commented: maaham banu on 11 Feb 2020
These two matrices are a result of log-polar map and then fft2 and fft2shift has been applied.
Now I want to apply the resulting matrices to get maximum average correlation peaks.
So, there are two matrices one is THETA_F1 with size of 512x642 and THETA_F2 with size of 245x321.
When I apply THETA_F1.*THETA_F2 whenever I apply this operation I get peaks in one region.
I want to get peak throughout which is only possible if I slide THETA_F2 over THETA_F1 and correlated them.
I tried nlfilter, blockproc but it isn't seem to work. How can I slide a kernel (THETA_F2) over THETA_F1 and multiply them and then plot the result.

Answers (1)

Subhadeep Koley
Subhadeep Koley on 10 Feb 2020
It seems the functon conv2 does what you are trying to achieve.
THETA_F1 = randi(512, 642); % Demp data
THETA_F2 = randi(245, 321); % Demo data
convolvedImg = conv2(THETA_F1, THETA_F2, 'same');
figure; imshow(convolvedImg, []);
See if this helps!

Community Treasure Hunt

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

Start Hunting!