Get perimeter of pixels around centre pixel

asked 2018-11-16 03:07:48 -0600

sazr gravatar image

updated 2018-11-16 03:12:39 -0600

I am attempting to get a circle of pixels around a centre pixel. Ie, just like how FAST keypoint detector works, I want to get the perimeter pixels around it given a radius. However the math escapes me, I know theoretically how I could obtain it using trigonometry. Ie, I could use a for loop and iterate at 15 degrees. I know the triangle hypotenuse length is the radius, I know the angle.

Any advice how I could obtain a perimeter of pixels around a given pixel?

image description

edit retag flag offensive close merge delete

Comments

example image / drawing or such, please.

berak gravatar imageberak ( 2018-11-16 03:11:34 -0600 )edit
1

@berak please see the updated post

sazr gravatar imagesazr ( 2018-11-16 03:12:51 -0600 )edit

is your radius fixed ? (you could use a precalculated list of indices, and an offset point)

berak gravatar imageberak ( 2018-11-16 03:17:01 -0600 )edit

@berak I would prefer the radius be variable if possible.

sazr gravatar imagesazr ( 2018-11-16 03:18:00 -0600 )edit

isn't it a bresenham circle ?

berak gravatar imageberak ( 2018-11-16 03:26:13 -0600 )edit

I would second berak's suggestion about precalculating indices. As getting the list of points is time consuming, I would precalculate the indices for each radius.

This is especially useful if you want to make the operation a high number of pixels.

kbarni gravatar imagekbarni ( 2018-11-16 05:51:30 -0600 )edit