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

2 次查看(过去 30 天)
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

回答(1 个)

Mann Baidi
Mann Baidi 2023-9-11
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!

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by