Draw a circle and measure the white pixels area inside

5 ビュー (過去 30 日間)
Hassan Khalil
Hassan Khalil 2019 年 8 月 1 日
コメント済み: Hassan Khalil 2019 年 8 月 22 日
Hello everyone, a binary image is obtained. The work is to draw concentric cirles in the image and calculate the area of the white pixels in each circle. The objective is to get a curve.
I attached an image as an example.
  2 件のコメント
Walter Roberson
Walter Roberson 2019 年 8 月 1 日
Construct a binary mask which is a circle of appropriate radius at appropriate center. Use .* to multiply the mask and the binary form of the image. nnz() then gives the white count.
Hassan Khalil
Hassan Khalil 2019 年 8 月 1 日
Thank you very much. It works. Not automatically for all the concentric radius but radius by radius. At each time, I change the radius value with the same center coordinates. The objective is done.

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

採用された回答

Walter Roberson
Walter Roberson 2019 年 8 月 1 日
You can construct a distance-squared matrix once. Then you can
sum(bsxfun(@le, distance_squared_matrix(:), radius_row_vector.^2))
to get the counts.
  1 件のコメント
Hassan Khalil
Hassan Khalil 2019 年 8 月 22 日
Come back from vacation to get a good idea proposed by you.
Thank you

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

その他の回答 (1 件)

KSSV
KSSV 2019 年 8 月 1 日
編集済み: Walter Roberson 2019 年 8 月 1 日
I = imread('image.png') ;
I1 = rgb2gray(I) ;
[y,x] = find(I1) ;
length(x)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by