Finding a 2d block with highest average inside a 2d window
1 次查看(过去 30 天)
显示 更早的评论
Consider a matrix A(52,34) How to find out which 2d block size(3,3) has the highest average in it
0 个评论
采纳的回答
Walter Roberson
2018-3-1
[~, 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 个评论
Walter Roberson
2018-3-2
[~, idx] = max( reshape(conv2(A, ones(3,3),'same'), [], 1) );
[r, c] = ind2sub(size(A), idx);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Scatter Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!