# finding number of pixels inside each circle

37 views (last 30 days)

Show older comments

### Accepted Answer

Image Analyst
on 26 Jan 2015

### More Answers (1)

Thorsten
on 21 Jan 2015

A well-known "approximation" is :-)

N = round(radius^2*pi)

You could also create a circle and count the pixels:

radius = 100;

x = [-radius: radius];

[X, Y] = meshgrid(x, x);

R = sqrt(X.^2 + Y.^2);

N = numel(find(R<=radius));

Both values are almost the same.

##### 2 Comments

Thorsten
on 26 Jan 2015

You can just use any other value for the radius, like

radius = 50;

and then compute the N to count the pixels in the circle of radius 50. Or what else do you need?

### See Also

### Community Treasure Hunt

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

Start Hunting!