Calculate the value of an area around a known co-ordinate

1 view (last 30 days)
Is it possible to calculate an average of a couple of pixel's value around a known co-ordinate?
I use the following equation:
%%
imtool (Thermal)
P = impixel(Thermal, X,Y)
Is there a wat to get the average of a few pixels around the X,Y instead of just the single value at this point (3 pixels around the X,Y co-ordinate)

Accepted Answer

Matt J
Matt J on 1 Jul 2022
Edited: Matt J on 1 Jul 2022
mean(Thermal(y-1:y+1,x-1:x+1),'all')
  3 Comments
Matt J
Matt J on 1 Jul 2022
Yes. You could also use movmean() or conv2() if you wanted the neighborhood means of every pixel.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!