MATLAB Answers

How to calculate the mean of an image if I want to delete some value?

1 view (last 30 days)
Ajaree Rattanaharn
Ajaree Rattanaharn on 17 Jan 2019
Edited: madhan ravi on 17 Jan 2019
value.png
the picture above show the value of my picture
I don't know how to calculate the mean of all value if I don't want the value that >185
I must use what code?
Help me please TT

  0 Comments

Sign in to comment.

Answers (1)

madhan ravi
madhan ravi on 17 Jan 2019
Edited: madhan ravi on 17 Jan 2019
matrix=double(matrix); % where matrix is the matrix of which you are trying to calculate the mean of
matrix(matrix>185)=NaN;
Result=mean(matrix(:),'omitnan') % mean along all dimensions
result=mean(a,1,'omitnan') % mean along columns
result=mean(a,2,'omitnan') % mean along rows
result(~isnan(result)) % to omit NaN values from the result

Sign in to answer this question.

Tags