How to Turn Imagesc to x and y?

3 次查看(过去 30 天)
Sushmitha Kudari
Sushmitha Kudari 2020-2-19
评论: Rik 2020-2-23
I have the following file MunkS_500Hz.shd.mat,
munkProfile = load('MunkS_500Hz.shd.mat');
pressureWave = munkProfile.pressure;
pressureWave = abs(pressureWave);
squished = squeeze(pressureWave);
figure
plot(squished);
logged = log(squished)
imag = imagesc(logged);
that I can make into a 501 x 1001 matrix. Now I want to take this matrix from imagesc and put make it into a 3D point cloud. I would like some advice on how to do this. (I am unable to insert the file here even as a .zip file, I can email it to you if you think you can help).

回答(2 个)

Rik
Rik 2020-2-19
编辑:Rik 2020-2-19
You can generate the coordinates with ndgrid and then you can linearize the three matrices and use them as input to plot3.
I=randi(255,501,1001);
[X,Y]=ndgrid(1:size(I,1),1:size(I,2));
plot3(X(:),Y(:),I(:),'.')
(untested code)
  5 个评论
Sushmitha Kudari
Sushmitha Kudari 2020-2-22
I need to create a 3D point cloud of the logged = log(squished) . For this i need only its x and y components. So for example if this is my x and y:
X Y
1 1
1 8
2 8
5 6
2 5
I want to add a z-component to each so that I can plot it 3D space:
X Y Z
1 1 0
1 1 1
1 1 2
1 1 3
...
1 8 0
1 8 1
1 8 2
...
and so on
Rik
Rik 2020-2-23
If you don't treat the pixel value as the z value, how are you using your data at all?

请先登录,再进行评论。


Sushmitha Kudari
Sushmitha Kudari 2020-2-21
I am trying to replicate this model (without the animation) using x and y from the logged. I want to make a 360 degree point cloud model by replicating x and y on different x planes.
%%will plot the formation of ripples on water surface ('_') ->
clear all
clc
x=-50:0.5:50;
y=-50:0.5:50;
[X,Y] = meshgrid(x,y); % create rectangular mesh
R=sqrt(X.^2+Y.^2); %radius
k=0.1; % wave vector
phi=0; % phase
count=1;
for freqrps=0.1:0.1:2*pi
Z=sin((2*pi-freqrps)*k*R);
surf(X,Y,Z,'Facecolor','blue','Edgecolor','none');
axis equal;
camlight right ;
lighting phong;
M(count)=getframe;
count=count+1;
end

类别

Help CenterFile Exchange 中查找有关 Point Cloud Processing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by