- 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 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Udit06
le 1 Sep 2023
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 commentaires
Voir également
Catégories
En savoir plus sur Image Segmentation and Analysis dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!