I have a problem in MATLAB as follows:
Suppose I have a matrix like given below. What I want to do is calculate the average values of the pixels given in yellow. (ans is 108)
This will be calculated if the option given is outside.
On the other hand if the option is given as inside, then an operation as performed in the image.
**I want to write an algorithm to find out the average value either inside or outside the region marked with zeros depending on the option manually set. **
****4 neighbourhood** or 8 neighbourhood ** may be considered. I want to compute this in MATLAB. Can you guys help me ?
Another solution:
use either:
or:
then: