Finding a 2d block with highest average inside a 2d window
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
MSP
am 1 Mär. 2018
Kommentiert: Walter Roberson
am 2 Mär. 2018
Consider a matrix A(52,34) How to find out which 2d block size(3,3) has the highest average in it
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 1 Mär. 2018
[~, idx] = max(conv2(A, ones(3,3),'same'))
[r, c] = ind2sub(size(A), idx);
r and c is now the index of the center of the block that had the highest average.
2 Kommentare
Walter Roberson
am 2 Mär. 2018
[~, idx] = max( reshape(conv2(A, ones(3,3),'same'), [], 1) );
[r, c] = ind2sub(size(A), idx);
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Scatter Plots 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!