finding block with minimum mean in cell array?

Hi, I have a problem with finding blocks with minimum mean in cell array. I have a cell array like
salientMask_B128x128=mat2cell(salientMask,128 * ones(1, size(salientMask,1) / 128), 128 * ones(1, size(salientMask,2) / 128));
that divide a 512x512 image to blocks with size 128x128. now I want to find 4 first blocks which have minimum mean. how can I do it?

1 件のコメント

nadia
nadia 2016 年 2 月 16 日
編集済み: nadia 2016 年 2 月 16 日
the indices of these blocks are very important for me and I should find them.

サインインしてコメントする。

 採用された回答

Jos (10584)
Jos (10584) 2016 年 2 月 16 日

0 投票

Get the mean for each block using cellfun, and apply a sort to get the indices in order.
M = cellfun (@(x) mean(x(:)), salientMask_B128x12) ;
[Msorted, idx] = sort(M(:)) ;
RequiredIndices = idx(1:4)

1 件のコメント

nadia
nadia 2016 年 2 月 16 日
thank you. it was very good. I did it with for loop but this is much better.

サインインしてコメントする。

その他の回答 (0 件)

質問済み:

2016 年 2 月 16 日

コメント済み:

2016 年 2 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by