How to calculate the mean from different images at once? TBV1 and RVI1 cover each other and have the same size. in the following code I calculated thea mean of all the pixels of Tb where the condition applies.I have 3 more set of Tbv and RVI .

1 回表示 (過去 30 日間)
I need to calculate mean of all pixel of TBs where condition (RVI>=0 and RVI<=0.2)applies.my images are Tbv2,Tbv3,Tbv4 and RVI2,RVI3,RVI4.Please note that I dont want to calculate mean of each image seperately.the mean should be calculated at once for all images.
Tbv1 = imread('tb.tif');
RVI1 =imread('rvi.tif')
ME = mean(Tbv1( RVI1>=0 & RVI1 <=0.2));

採用された回答

Guillaume
Guillaume 2014 年 10 月 23 日
Concatenate your images in cell arrays, and use cellfun to calculate the mean in one go:
Tbv = {Tbv1, Tbv2, Tbv3, Tbv4};
Rvi = {Rvi1, Rvi2, Rvi3, Rvi4};
me = cellfun(@(tbv, rvi) mean(tbv(rvi>=0 & rvi<=0.2)), Tbv, Rvi);
  4 件のコメント
Image Analyst
Image Analyst 2014 年 10 月 31 日
編集済み: Image Analyst 2014 年 10 月 31 日
If you no longer need the big cell arrays after that, you might clear them to free up memory:
clear('Tbv', 'Rvi');
Please officially accept the answer.
Hana
Hana 2014 年 11 月 13 日
me = cellfun(@(tbv, rvi) mean(tbv(rvi>=0 & rvi<=0.2)), Tbv, Rvi); gives me 4 mean value seperately from tha pair (Tbv1,Rvi1)....(Tbv4,Rvi4) I need a single mean value from all the pairs.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpline Postprocessing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by