How to find z coordinate while having only x and y coordinates on images?

22 Ansichten (letzte 30 Tage)
Hi, im looking a z-coordinate on an 2D image that I already use a mesh to find diameter on 3D graph. Here i attach my codes that i try on this link.
I = imread ("01_manual1.gif");
edtImage = 2 * bwdist(~I);
skel = bwmorph(I, 'skel', Inf);
diameterImage = edtImage .* double(skel);
mesh (diameterImage);
Next, i already have x and y coordinate but i have to get the z coordinate without referring to the graph which is automatically find the z.
Here my x and y coordinates.
x y
78 198
145 238
26 268
94 198
35 292
111 202
138 294
57 205
49 307
50 210
68 318
136 221
37 223
147 246
149 258
29 280
97 320
86 321
i want to find the z coordinate to plot a point on the 3d graph sing plot3. I hope anyone can help me or suggest me a better method. Thank you.

Antworten (2)

KSSV
KSSV am 15 Jun. 2022
Bearbeitet: KSSV am 15 Jun. 2022
Read about interp2
  2 Kommentare
Nasiruddin Zh
Nasiruddin Zh am 15 Jun. 2022
i already read that but i didnt understand how can i do with the query points which is xq and yq.
Nasiruddin Zh
Nasiruddin Zh am 21 Jun. 2022
hi, thank you for your suggestion. i already got the data by using this.
z = interp2(diameterImage, x, y);

Melden Sie sich an, um zu kommentieren.


Image Analyst
Image Analyst am 15 Jun. 2022
If you have x and y (as you said) then you can get the diameter (Z) by
diameterZ = diameterImage (y, x);
  1 Kommentar
Nasiruddin Zh
Nasiruddin Zh am 15 Jun. 2022
if im using that i will get 18 * 18 matrix.
let say im adding this.
mesh (diameterImage);
hold on; plot(x,y,'+k','MarkerSize',10,'Color','r','LineWidth',1.5);
hold off
diameterZ = diameterImage (x,y);
i want the z coordinate only at 18*1 matrix from the x and y above.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by