normalRotation
Description
returns the geometric transformation object for a normal vector of a plane to the
reference vector, tform
= normalRotation(model
,referenceVector
)referenceVector
. model
is a planeModel
.
Examples
Transform Point Cloud
Construct a velodyneFileReader object.
veloReader = velodyneFileReader('lidarData_ConstructionRoad.pcap','HDL32E');
Read the first frame of lidar data.
frameNumber = 1; ptCloud = readFrame(veloReader,frameNumber);
Find the ground plane.
maxDistance = 0.4; referenceVector = [0 0 1]; groundPlane = pcfitplane(ptCloud,maxDistance,referenceVector);
Transform the ground plane such that it is parallel to the X-Y plane.
tform = normalRotation(groundPlane,referenceVector);
Transform the point cloud.
ptCloudOut = pctransform(ptCloud,tform);
Display the original and transformed point cloud.
planeParams = groundPlane.Parameters * tform.T; transformedPlane = planeModel(planeParams); figure; pcshowpair(ptCloudOut,ptCloud); hold on; plot(groundPlane, 'Color', 'magenta'); plot(transformedPlane, 'Color', 'green');
Input Arguments
model
— Parametric plane model
plane model
Parametric plane model returned by planeModel
.
referenceVector
— Reference vector
1-by-3 vector
Reference vector, specified as a 1-by-3 vector.
Output Arguments
tform
— Geometric transformation
rigidtform3d
object
Geometric transformation, returned as a rigidtform3d
object. The rigidtform3d
object
describes the rigid 3-D transformation that aligns the normal vector of a
plane to referenceVector
.
Version History
Introduced in R2020bR2022b: Returns rigidtform3d
object
Starting in R2022b, most Computer Vision Toolbox™ functions create and perform geometric transformations using the
premultiply convention. Accordingly, the normalRotation
function now returns tform
as a rigidtform3d
object, which uses the premultiply convention. Before,
the function returned tform
as a rigid3d
object, which uses the postmultiply convention. For more information, see
Migrate Geometric Transformations to Premultiply Convention.
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)