std2 ROI

1 回表示 (過去 30 日間)
Joe
Joe 2011 年 8 月 29 日
Hi,
I am looking to calculate the standard deviation of intensity values of a grayscale image.
I do not want to calculate the standard deviation of the entire image, but just a ROI.
I can create a binary mask, but can not see a way of using this to extract the ROI statistics.
Any help would be greatly appreciated.
Cheers,
Joe

採用された回答

Gareth Thomas
Gareth Thomas 2011 年 8 月 29 日
Hi Joe,
Maybe I miss understood what you were aiming for but try logical indexing.
img = imread('pout.tif');
h_im = imshow(img);
e = imellipse(gca,[55 10 120 120]);
BW = createMask(e,h_im);
imshow(BW)
std2(img)
std2(img(BW))
Does this give you what you were looking for?
The idea here is simple. std2(A) gives the same as as std(A(:))
But the important thing is if you only want part of A, use the logical indexing to get those numbers.
Simple example:
a = [1 2 3 4; 2 3 4 5; 2 3 4 4; 4 4 1 2]
BW=a>=3
a(BW)
std2(a(BW))
Hope this helps.
  1 件のコメント
Joe
Joe 2011 年 8 月 31 日
std2(image(binary_mask)) gives me what I'm looking for.
Thanks for the help.
Joe

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

その他の回答 (1 件)

David Young
David Young 2011 年 8 月 29 日
std(Image(logical(binary_mask)))

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by