How do I get windows of several feature points in an image, and return the intensity of all the pixels in that window?

2 views (last 30 days)
Hi! I have a image (2d double array) and a bunch of feature points (x and y coordinates, bule crosses in the image). Now I want to get 5-by-5 windows of those feature points in an image, and return the intensity of all the pixels in that window. I know "meshgrid" is a good function, but I failed. Is there any build-in function in matlab I can use or what should I do to meet the requirement? Thank you very much.
Say M*N is the size of the image, X1 and Y1 are the coordinates of the cross points

Answers (1)

Mann Baidi
Mann Baidi on 11 Sep 2023
Hi Yuhong,
I understand that you want to get the intensity of pixel of a 5x5 window size window at specific pixels. For this we can try out the following code:
value = I(y, x);
values = I(y-5:y+5, x-5:x+5);
The “values” will contain the intensity of the pixels in the window.
Hope this helps!

Categories

Find more on Images in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!