Draw a circle and measure the white pixels area inside
조회 수: 5 (최근 30일)
이전 댓글 표시
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
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.
채택된 답변
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개)
KSSV
2019년 8월 1일
편집: Walter Roberson
2019년 8월 1일
I = imread('image.png') ;
I1 = rgb2gray(I) ;
[y,x] = find(I1) ;
length(x)
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!