How sampling 3d scattered points

Hi everyone,
I have a 3D matrix that represents the coordinates of 108 points in the 3d Cartesian space. So, for every row, i have the coordinates of a point. These points represent the centerline of a leaflet of the mitral valve.
My goal is to sample this points in order to pass from 108 points to 32 points keeping the same shape of the centerline of the leaflet of the mitral valve of the 108 points.
How can i do this?
Thanks in advance for the help.
I have attached also a figure that represents the position of the points.
Lorenzo

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 12 月 3 日

1 投票

One option is to use interp1()
X = rand(108, 3);
t = linspace(0,1,size(X,1));
t_new = linspace(0,1,32);
X_new = interp1(t, X, t_new);

4 件のコメント

Lorenzo Bennati
Lorenzo Bennati 2020 年 12 月 3 日
Dear Ameer,
Thanks for the answer.
To be sure, if i want to give as imput my matrix S to the function rand, how can i do? Because the output X_new does not represent my centerline
Thanks in advice
Ameer Hamza
Ameer Hamza 2020 年 12 月 3 日
rand(108,3) is just an example, If you matrix name is S, you can change X to S
t = linspace(0,1,size(S,1));
t_new = linspace(0,1,32);
S_new = interp1(t, S, t_new);
Note: this assumes that matrix is 108x3, i.e., each row is a point.
Lorenzo Bennati
Lorenzo Bennati 2020 年 12 月 3 日
Thank you very much for the help
Ameer Hamza
Ameer Hamza 2020 年 12 月 3 日
I am glad to be of help!!!

サインインしてコメントする。

カテゴリ

タグ

質問済み:

2020 年 12 月 3 日

コメント済み:

2020 年 12 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by