필터 지우기
필터 지우기

neighbourhood of centre point(x,y)

조회 수: 4 (최근 30일)
wa
wa 2015년 12월 7일
답변: Walter Roberson 2015년 12월 7일
I have a point (x,y)(centre of image) and the radius r is 12, so I want to find all the points within r of 12 to the point (x,y). I know spatial filtering and have applied nfilter for centre pixel
  댓글 수: 1
Adam
Adam 2015년 12월 7일
Isn't it just simply all points within a radius 12 circle? Which is just a Pythagoras calculation on every point vs the centre.
Or to be more efficient, on every point inside a 25-by-25 square centred on your image centre since no point outside that can be within a radius of 12.

댓글을 달려면 로그인하십시오.

답변 (2개)

Image Analyst
Image Analyst 2015년 12월 7일

Walter Roberson
Walter Roberson 2015년 12월 7일
One time, You start with a 25 x 25 array and compute all the points within r = 12 of the center point. This will allow you to construct a list of (signed) relative rows and columns of the points that are within range. You can then hard-code that list.
Then once you know the actual image size, before you loop, you multiply the (signed) relative column offsets by the number of rows in the image, and add the (signed) relative row offsets. The result will give you a list of relative linear indices.
Now as you go through the matrix, you can add the list of relative linear indices to your current linear index, in order to calculate the linear indices of the points that are within range; you can then extract their values and do whatever with them. Just watch out for the borders -- these relative calculations would only be good from row 12 to row end-11 and column 12 to column end-11 .

카테고리

Help CenterFile Exchange에서 Visualization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by