How can I find exactly the coordinates of the center of the yellow circle?

3 visualizaciones (últimos 30 días)
Hi everybody,
maybe my problem is stupid, but I need your help. I need to find exactly the center of the yellow circle in my image. It's an electromagnetic field distribution and I need to know whwre is centered, because it's not in the center of the image. Is there a way to find it out? I'm working with a 601x601x13 double matrix, I plotted the distribution at a certain height along the Z axis. Thanks to anyone who will give me a hand.
  4 comentarios
Matt J
Matt J el 15 de Mayo de 2021
Editada: Matt J el 15 de Mayo de 2021
If you have a mathematical model for the field distribution, it would be most accurate to fit the model parameters to your data and determine the center from the continuous model.
Martina Falchi
Martina Falchi el 15 de Mayo de 2021
I calculated my field distribution with the Biot-Savart low. I have to work on the image now.

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 15 de Mayo de 2021
Editada: Image Analyst el 15 de Mayo de 2021
  7 comentarios
Walter Roberson
Walter Roberson el 16 de Mayo de 2021
Experimenting:
format long g
rvec = linspace(-5,5,100);
cvec = linspace(-5,5,100);
[r, c] = ndgrid(rvec, cvec);
actual_center = randn(1,2)
actual_center = 1×2
1.11743259398499 -2.42572497175217
A = 10 .* exp(-(r-actual_center(1)).^2/2) .* exp(-(c-actual_center(2)).^2/2);
pcolor(r, c, A)
ideal_array_r = interp1(rvec, 1:length(rvec), actual_center(1))
ideal_array_r =
61.5625826804514
ideal_array_c = interp1(cvec, 1:length(cvec), actual_center(2))
ideal_array_c =
26.4853227796535
tot_mass = sum(A(:));
[ii,jj] = ndgrid(1:size(A,1),1:size(A,2));
R = sum(ii(:).*A(:))/tot_mass;
C = sum(jj(:).*A(:))/tot_mass;
out = [tot_mass,R,C]
out = 1×3
6131.2848647514 61.5608654718254 26.6115951119575
calculated_array_r = R
calculated_array_r =
61.5608654718254
calcualted_array_c = C
calcualted_array_c =
26.6115951119575
So that is actual 61.5628526804514 versus calculated 61.5608654718254 and actual 26.4853227796535 versus calculated 26.6115951119575
Accuracy in the first case was about 1/100 which is less than 1 / number of bins in that direction.
Accuracy in the second case was about 13/100 which is notably less precise.
This hints that the accuracy can depend upon how close to the edge of the image that you are, in cases where data is being effectively truncated. This makes sense from a mathematical perspective.
Martina Falchi
Martina Falchi el 16 de Mayo de 2021
Thank you a lot for this explanation, it was exhaustive.

Iniciar sesión para comentar.

Más respuestas (2)

Matt J
Matt J el 15 de Mayo de 2021
regionprops3( true(size(yourImage)) ,yourImage, 'WeightedCentroid')

Rakesh Das
Rakesh Das el 15 de Mayo de 2021
circle is (x – h)2+ (y – k)2 = r2, where (h, k) represents the coordinates of the center of the circle, and r represents the radius of the circle. If a circle is tangent to the x-axis at (3,0), this means it touches the x-axis at that point. this is the concept of obtating the coordinates of yellow circle.

Community Treasure Hunt

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

Start Hunting!

Translated by