let x is an image of m*n (512*512) pixel how to find the mean of x, what is the matlab code

1 回表示 (過去 30 日間)
aditya kumar sahu
aditya kumar sahu 2016 年 12 月 20 日
回答済み: Image Analyst 2016 年 12 月 20 日
let x is an image of m*n (512*512) pixel how to find the mean of x, what is the matlab code

回答 (3 件)

KSSV
KSSV 2016 年 12 月 20 日
doc mean2

Jan
Jan 2016 年 12 月 20 日
編集済み: Jan 2016 年 12 月 20 日
Instead of mean2 you can easily use:
xm = mean(x(:))
But note, that this answer is trivial. Searching the documentation would have solved this also:
docsearch mean

Image Analyst
Image Analyst 2016 年 12 月 20 日
Using mean() or mean2() is so obvious that I'm wondering if you actually wanted something different. Here are some related alternatives.
If you want a local/moving mean instead of the mean of the entire image, you can use conv2() or imfilter().
windowSize = 5;
kernel = ones(windowSize) / windowSize^2;
out = conv2(double(grayImage), kernel, 'same');
If you want the mean of tiles/blocks, you can use blockproc(). Demos attached.
If you want the mean in only part of an image that is defined by a mask, you can do
meanWithinMask = mean(grayImage(mask));

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by