I want to solve the equation (2) in the attached picture which tells the local mean value. But i don't have any idea about how to evaluate this equation using matlab code. could only guess w indicates window size. What does g(m,n) means? Can anyone please help me to understand this concept?


  • 1
    $\begingroup$ There is nothing to solve here. Equation 2 is a definition of $\bar{g}$. All you need to do is to evaluate it. $\endgroup$
    – A_A
    Commented Feb 27, 2019 at 7:41
  • $\begingroup$ yes i dont have any idea about how to evaluate it. $\endgroup$
    – Emerson EJ
    Commented Feb 27, 2019 at 8:28
  • $\begingroup$ @EmersonEJ, Could you review my answer? $\endgroup$
    – Royi
    Commented Jul 12, 2023 at 11:28

1 Answer 1


This is basically a filter which calculates the mean.

In MATLAB you can achieve this using:

mK = ones(w, w) / (w * w);
mGBar = imfilter(mG, mK);

Basically the value of mGBar(m, n) equals to the mean value of a window of size wxw centered at mG(m, n).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.