Draw a circle and measure the white pixels area inside
7 views (last 30 days)
Show older comments
Hassan Khalil
on 1 Aug 2019
Commented: Hassan Khalil
on 22 Aug 2019
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 Comments
Walter Roberson
on 1 Aug 2019
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.
Accepted Answer
Walter Roberson
on 1 Aug 2019
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.
More Answers (1)
KSSV
on 1 Aug 2019
Edited: Walter Roberson
on 1 Aug 2019
I = imread('image.png') ;
I1 = rgb2gray(I) ;
[y,x] = find(I1) ;
length(x)
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!