How do I calculate eccentricity or RMSE value from black and white image?

2 Ansichten (letzte 30 Tage)
HyoJae Lee
HyoJae Lee am 23 Aug. 2022
Beantwortet: Udit06 am 1 Sep. 2023
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'])
i = 2150×2150
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
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.

Antworten (1)

Udit06
Udit06 am 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:
  1. Find the coordinates of points in the white region.
  2. Find the point belonging to the white region, which is at the maximum distance from the lower-right corner of the image.
  3. Use the maximum distance obtained as the radius to draw the quarter circle.
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.

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by