How can I find exactly the coordinates of the center of the yellow circle?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Martina Falchi
le 15 Mai 2021
Commenté : Martina Falchi
le 16 Mai 2021
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 commentaires
Réponse acceptée
Walter Roberson
le 15 Mai 2021
Modifié(e) : Image Analyst
le 15 Mai 2021
You can calculate the center of mass of the image.
7 commentaires
Walter Roberson
le 16 Mai 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)
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_c = interp1(cvec, 1:length(cvec), actual_center(2))
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]
calculated_array_r = R
calcualted_array_c = C
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.
Plus de réponses (2)
Rakesh Das
le 15 Mai 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.
0 commentaires
Voir également
Catégories
En savoir plus sur Number Theory dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!