pixels inside circle

19 ビュー (過去 30 日間)
thoraya
thoraya 2012 年 5 月 21 日
コメント済み: Image Analyst 2018 年 5 月 4 日
hi; i need to find pixel coordinates inside a given circle C which is defined by its center position (x , y ) and its radius r. then i need also to find pixel coordinates located at the border of this circle knowing that the width of border is set at 1 or 2 pixels.

回答 (1 件)

Image Analyst
Image Analyst 2012 年 5 月 21 日
Have you tried the code in the FAQ: http://matlab.wikia.com/wiki/FAQ#How_do_I_create_a_circle.3F It should be just slight modifications, if any, to get what you want.
  3 件のコメント
Shaban Sikander
Shaban Sikander 2018 年 5 月 4 日
How to find the black pixels inside a specific circle?
Image Analyst
Image Analyst 2018 年 5 月 4 日
What does "find" mean to you?
To get a binary image with the black pixels indicated as "true", do
blackPixelMask = grayImage == 0; % Map of all black pixels.
blackPixelMask = blackPixelMask & circleMask; % Erase those outside the circle mask.
To count the number of black pixels, do this:
Make a circle mask, like the FAQ shows you. Then count the black pixels:
pixelsInCircleMask = grayImage(circleMask);
numBlackPixels = sum(pixelsInCircleMask)
Otherwise you'll have to give a precise definition of what the word "find" means to you in this context, because it's ambiguous. I don't know what it means to you.

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

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by