- Find the coordinates of points in the white region.
- Find the point belonging to the white region, which is at the maximum distance from the lower-right corner of the image.
- Use the maximum distance obtained as the radius to draw the quarter circle.
How do I calculate eccentricity or RMSE value from black and white image?
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello,
I have a question regrading to image analysis.
Here, I have a image like this black and white image.
i=imread(['BW_20220804_0301.jpg'])
imshow(i)
I want to calculate how much this quarter-circular shaped image (white area) eccentric when we impose ideal quarter circle.
Also, I want to know a radius of the ideal quarter circle.
How can I make this?
Thanks, HyoJae.
댓글 수: 0
답변 (1개)
Udit06
2023년 9월 1일
Hi HyoJae,
I understand that you want to make a quarter circle which is just large enough to cover the entire white region in your binary image. Assuming the white region is always at the lower-right corner of the image, you can follow the steps mentioned below:
Here is the implementation of above steps in MATLAB:
binaryImage=imread("BW_20220804_0301.jpg");
% Step 1: Find the coordinates of the white object
[rows, cols] = find(binaryImage == 1);
minX = min(cols);
maxY = max(rows);
% Step 2: Calculate the radius of the quarter circle
fig_size=2150;
radius= max(sqrt((cols-fig_size).^2 + (rows-fig_size).^2))
% Step 3: Draw the quarter circle on the image
figure;
imshow(binaryImage); % Replace 'yourImage' with your actual image
hold on;
% Calculate the center point of the quarter circle
center = [size(binaryImage, 2), size(binaryImage, 1)];
% Draw the quarter circle using the 'rectangle' function
rectangle('Position', [center(1) - radius, center(2) - radius, radius*2, radius*2], ...
'Curvature', [1, 1], 'EdgeColor', 'r', 'LineWidth', 2);
hold off;
To determine the extent to which the white region deviates from an ideal quarter circle, you can calculate the area difference between the white region and the corresponding ideal quarter circle.
I hope this helps.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!