finding number of pixels inside each circle

15 ビュー (過去 30 日間)
Dhandapani.S
Dhandapani.S 2015 年 1 月 21 日
コメント済み: Dhandapani.S 2015 年 2 月 1 日
i am drawing circles of different radius on a jpg image. how to find the number of pixels in each circle. i have to compare the pixel distribution ratio in each circle
  3 件のコメント
Image Analyst
Image Analyst 2015 年 1 月 21 日
What is a "pixel distribution ratio"?
Dhandapani.S
Dhandapani.S 2015 年 1 月 21 日
編集済み: Image Analyst 2015 年 1 月 26 日
say, for inner most circle, there may be 20% of the total pixels of the jpeg image. the next immediate outer circle may contain 40 % of the total jpeg image pixels. this is a kind of segmentation i think. please give me a solution. thank you in advance.

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2015 年 1 月 26 日
I'm pretty sure I gave you the answer in your other question: http://www.mathworks.com/matlabcentral/answers/169093#comment_261946 How is this any different than that?
  3 件のコメント
Image Analyst
Image Analyst 2015 年 1 月 26 日
Just try it and see. Create a mask for triangles with poly2mask().
xTriangle = [x1,x2,x3,x1]; % Make a list of the coordinates of the vertices.
yTriangle = [y1,y2,y3,y1];
[rows, columns, numberOfColorChannels] = size(yourImage);
binaryImage = poly2mask(xTriangle, yTriangle, rows, columns);
Dhandapani.S
Dhandapani.S 2015 年 2 月 1 日
dear image analyst, you have made the work with concentric circles and i got good results. i am trying with triangles, rectangles and spheres.but cannot accomplish. iget the error with bwboundaries. since bwboundaries is 2d i cannot make it up to sphere. please help me in rectangle and triangle.

サインインしてコメントする。

その他の回答 (1 件)

Thorsten
Thorsten 2015 年 1 月 21 日
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 件のコメント
Dhandapani.S
Dhandapani.S 2015 年 1 月 21 日
thank you. i get 31417 for N. i have a jpeg image. i have to draw circles with different radius keeping the center point of the jpeg image as the circle center. i need to count the pixels in each circle and find the pixel ratio of the jpeg image in each circle. please help me.
Thorsten
Thorsten 2015 年 1 月 26 日
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?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImage Segmentation and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by