필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
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
Matt J
Matt J 2021년 5월 15일
편집: Matt J 2021년 5월 15일
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 2021년 5월 15일
I calculated my field distribution with the Biot-Savart low. I have to work on the image now.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2021년 5월 15일
편집: Image Analyst 2021년 5월 15일
  댓글 수: 7
Walter Roberson
Walter Roberson 2021년 5월 16일
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 2021년 5월 16일
Thank you a lot for this explanation, it was exhaustive.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Matt J
Matt J 2021년 5월 15일
regionprops3( true(size(yourImage)) ,yourImage, 'WeightedCentroid')

Rakesh Das
Rakesh Das 2021년 5월 15일
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.

카테고리

Help CenterFile Exchange에서 Number Theory에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by