How to generate a point cloud in 3D?

Hello dear community,
I would like to know if there is a fast way to create a cloud in 3D which consists of points. I would like to get something like this:
The points should be written into a simple matrix. Each row should represent one point. Thank you for your help!

 採用された回答

Mike Garrity
Mike Garrity 2015 年 11 月 16 日
編集済み: Mike Garrity 2015 年 11 月 16 日

2 投票

This might be a good starting point:
[x,y,z] = ndgrid(1:5:100,1:5:100,1:5:100);
scatter3(x(:),y(:),z(:),'.')
The ndgrid function will return multiple arrays of the same shape with one of its inputs replicated along one dimension of each of its outputs.
The syntax x(:) says to convert that 3D array into a vector.
The scatter3 function takes 3 vectors and plots a marker at the location defined by each row of the three.
The '.' argument to scatter3 tells it to draw a dot, rather than one of the bigger and more complex markers.

6 件のコメント

Leo Müller
Leo Müller 2015 年 11 月 18 日
Thank you for you help! I will try it out.
Kachireddy Malleswari
Kachireddy Malleswari 2017 年 9 月 23 日
Hi Mike, your code is very simple and good. I want to generate a point cloud of a 4 walled surface, similar to a simple room. Can u plzz help me how to go about that.
Walter Roberson
Walter Roberson 2017 年 9 月 23 日
h = 10; w = 15; d = 12;
hv = linspace(0, h, 30);
wv = linspace(0, w, 30);
dv = linspace(0, d, 30);
[tbx, tby, tbz] = ndgrid(wv, dv, hv([1 end]) );
[lrx, lry, lrz] = ndgrid(wv([1 end]), dv, hv);
[fbx, fby, fbz] = ndgrid(wv, dv([1 end]), hv);
allx = [tbx(:); lrx(:); fbx(:)];
ally = [tby(:); lry(:); fby(:)];
allz = [tbz(:); lrz(:); fbz(:)];
scatter3(allx, ally, allz)
RAMYA M
RAMYA M 2019 年 6 月 3 日
Hi.. Could you please help me in generating a point cloud from the .stl file
Halil Bölük
Halil Bölük 2020 年 4 月 30 日
Hello RAMYA. I need stl to point cloud transformation. Did you find anything about this ?
elnaz gh
elnaz gh 2020 年 9 月 14 日
Hello you can use meshlabjs(it is online) and upload yor .stl file and then search "sampling" then select poission disk sampling or monto carlo sampling,

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

その他の回答 (1 件)

faten emad
faten emad 2018 年 9 月 17 日

0 投票

Hi Mike, your code is very good. I want to generate a point cloud of moving scan camera can you help me?

5 件のコメント

Walter Roberson
Walter Roberson 2018 年 9 月 19 日
Can you link to an example image?
faten emad
faten emad 2018 年 9 月 19 日

https://www.youtube.com/watch?v=vGHnpNNRHrw

i want to make like this video

Walter Roberson
Walter Roberson 2018 年 9 月 19 日
If you do not have a time-marked stream of data available, then you would need to have some kind of model of the object and you would need to do the equivalent of raycasting to generate points over time and add them to the pointcloud as you go.
faten emad
faten emad 2018 年 9 月 20 日
can you help me with the codes?

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

カテゴリ

ヘルプ センター および File ExchangeBig Data Processing についてさらに検索

質問済み:

2015 年 11 月 16 日

コメント済み:

2020 年 9 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by