pcshow - rescale axes on 3D pointcloud display
8 次查看(过去 30 天)
显示 更早的评论
I'd like to rescale the axes shown from pcshow. See attached screeshot. I'd like to input some argument into the pcshow function so as to avoid manually rescaling the axes each time if possible.
Thank you :)
0 个评论
回答(2 个)
Gonçalo Moreira
2021-8-25
hey, you have to modify the DataAspectRatio property of the point cloud object, which defaults to [1 1 1]!
Here's an example on how to make all axis equal:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all; close all;
% Random point cloud with 1000 (x, y, z) triplets with a dimension of roughly 30x10x5
mat = [round(30*randn(1000,1)),round(10*randn(1000,1)),round(5*randn(1000,1))];
% Show point cloud
ax = pcshow(mat)
% Normalize the data relative to the Y axis
ax.DataAspectRatio = [diff(ax.XLim), diff(ax.YLim), diff(ax.ZLim)] / diff(ax.YLim);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Hope it helps!
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Point Cloud Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!