pctransform
Transform 3-D point cloud
描述
应用指定的3-D仿射变换,ptcloudout
= pctransform(ptCloudIn
,,,,tform
)tform
to the point cloud,ptCloudIn
。转换可以是刚性或非辅助变换。
应用位移字段ptcloudout
= pctransform(ptCloudIn
,,,,d
)d
到点云。使用位移字段的点云转换相对于点云中的每个点定义了翻译。
例子
使用刚性转换旋转3-D点云
阅读点云。
ptCloud = pcread('茶壶);
绘制点云。
图PCSHOW(PTCLOUD)XLABEL('X')ylabel('Y')Zlabel('Z')
Create a transform object with a 45 degree rotation along the z-axis.
theta = pi/4;rot = [cos(theta)sin(theta)0;...-sin(theta) cos(theta) 0;...0 0 1];trans = [0,0,0];tform = rigid3d(rot,trans);
转换点云。
ptcloudout = pctransform(ptcloud,tform);
绘制转换的点云。
figure pcshow(ptCloudOut) xlabel('X')ylabel('Y')Zlabel('Z')
3-D点云的仿射变换
This example shows affine transformation of a 3-D point cloud. The specified forward transform can be a rigid or nonrigid transform. The transformations shown includes rotation (rigid transform) and shearing (nonrigid transform) of the input point cloud.
Read a point cloud into the workspace.
ptCloud = pcread('茶壶);
3-D点云的旋转
Create an affine transform object that defines a 45 degree rotation along thez-轴。
a = [cos(pi/4)sin(pi/4)0 0;...-sin(pi/4)cos(pi/4)0 0;...0 0 1 0;...0 0 0 1]; tform = affine3d(A);
转换点云。
ptcloudout1 = pctransform(ptCloud,tform);
3-D点云的剪切
创建一个仿射转换对象,该对象定义沿着X-轴。
a = [1 0 0 0;...0.75 1 0 0;...0.75 0 1 0;...0 0 0 1]; tform = affine3d(A);
转换点云。
ptCloudout2 = pctransform(ptcloud,tform);
显示原始和仿射转换的3-D点云
绘制原始的3-D点云。
figure1 = figure(“窗口”,,,,'普通的');axes1 =轴(轴'Parent',,,,figure1); pcshow(ptCloud,'Parent',axes1);Xlabel('X');ylabel('Y');Zlabel('Z');title(“ 3-D点云”,,,,'字体大小',14)
%绘制旋转和剪切仿射转化的3-D点云。figure2 = figure(“窗口”,,,,'普通的');axes2 =轴(轴'Parent',图2);pcshow(ptcloudout1,'Parent',axes2);Xlabel('X');ylabel('Y');Zlabel('Z');title({'Rotation of 3-D Point Cloud'},'字体大小',14)
图3 =图(“窗口”,,,,'普通的');axes3 = axes('Parent',,,,figure3); pcshow(ptCloudOut2,'Parent',,,,axes3); xlabel('X');ylabel('Y');Zlabel('Z');title({'Shearing of 3-D Point Cloud'},'字体大小',14)
使用位移字段的点云转换
Read a point cloud into the workspace.
ptCloud = pcread('茶壶);
创建一个位移字段d
与点云相同的大小。
d = zeros(size(ptcloud.location));
将位移字段值沿X-axis for the first half of the points to 7.
pthalf = ptcloud.count/2;d(1:pthalf,1)= 7;
Extract the indices of points within a region-of-interest (ROI) using thepointCloud
方法Findneighborsinradius
。将位移字段值沿X-,y-, 和z- ROI内的点分别为4、4和-2。
indices = findneighborsinradius(ptcloud,[0 0 3.1],1.5);d(指数,1:2)= 4;d(指数,3)= -2;
使用位移字段转换点云。
ptcloudout = pctransform(ptcloud,d);
显示原始和转换的点云。
图PCSHOW(PTCLOUD)XLABEL('X');ylabel('Y');Zlabel('Z');title(“原始3-D点云”)
figure pcshow(ptCloudOut) xlabel('X');ylabel('Y');Zlabel('Z');title(“使用位移字段转换3-D点云”)
输入参数
ptCloudIn
-点云
pointCloud
目的
点云,,,,specified as apointCloud
目的。
tform
-3-D几何变换
刚性3D
目的|仿射3D
目的
3-D几何变换,,,,specified as a刚性3D
对象或一个仿射3D
目的。看define Transformation Matrix有关如何设置仿射3-D的详细信息tform
输入。
d
-位移字段
m-by-3矩阵|m-by-n-by-3 array
位移字段,指定为m-by-3 or anm-by-n-by-3 array. The displacement field is a set of displacement vectors that specify the magnitude and direction of translation for each point in the point cloud. The size of the displacement field must be the same as the size of the地点
property of thepointCloud
目的。
数据类型:单身的
|双倍的
输出参数
ptcloudout
- 转换点云
pointCloud
目的
转换点云,返回pointCloud
目的。The transformation applies to the coordinates of points and their normal vectors.
扩展功能
C/C ++代码生成
Generate C and C++ code using MATLAB® Coder™.
GPU代码生成
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.
版本历史记录
matlab命令
您单击了与此MATLAB命令相对应的链接:
通过在MATLAB命令窗口中输入该命令。Web浏览器不支持MATLAB命令。万博1manbetx
You can also select a web site from the following list:
如何获得最佳网站性能
选择中国网站(中文或英语)以获得最佳场地性能。其他Mathworks乡村网站未针对您所在的访问进行优化。
美洲
- América Latina(Español)
- 加拿大(英语)
- 美国(英语)