Sample a 3D surface

5 ビュー (過去 30 日間)
Carmine Buonagura
Carmine Buonagura 2020 年 9 月 24 日
編集済み: Turlough Hughes 2020 年 9 月 24 日
Good morning, I have a png image and I would like to get a 3D point cloud from it.
Up until now, I' ve imported the image, I' ve converted it in a grayscale image and generated a mesh from it as follows.
heightmap = imread('C:\Users\carmine\OneDrive\Desktop\heightmap.png');
imshow(heightmap);
b = rgb2gray(heightmap);
b = im2double(b);
imshow(b);
shading interp
f=mesh(b);
The problem is that I can't obtain a points cloud from this surface. With python it was possible to use this command:
mesh.sample(num_of_points)
Do you agree with my procedure? In this case I just have to sample the surface in an arbitrary number of points.
Is there another way to reconstruct directly the 3D points cloud from the rgb image or from the grayscale one?

採用された回答

Turlough Hughes
Turlough Hughes 2020 年 9 月 24 日
編集済み: Turlough Hughes 2020 年 9 月 24 日
If I understand correctly, you just want to generate some x,y values that match your z values (i.e. b):
[x,y] = meshgrid(1:size(b,2),1:size(b,1));
You can then plot the 3d point cloud with scatter3:
scatter3(x(:),y(:),b(:),[],b(:),'.')

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePoint Cloud Processing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by