Description
Hi David:
I needed your help really bad.
I have two 3D point clouds that are oriented very similarly. When I use the orientedbox3d,
% Zero center the point cloud data
pcMean = mean(ptCloudWork.Location, 1);
pcZeroCentered = bsxfun(@minus, ptCloudWork.Location, pcMean);
% Find the axis-orientation of the point cloud
OOBB = orientedBox3d(double(pcZeroCentered));
the orientations, yaw. pitch and roll angles are very different. Aren't they should be similar?
Figure 1,
OOBB1 = -2.7616 -1.2016 -3.5781 223.5262 215.7089 54.8219 -178.3561 1.8756 -7.0416
Figure 3,
OOBB3 = 0.9134 -1.2887 -5.8636 216.6893 214.4492 62.4261 -87.0472 8.7291 -178.4361
The main objective is to re-orient the point clouds parallel to XY, YZ, and XZ planes. Below is the code snippet that does it.
% Transformation matrix
deg = [OOBB(7) OOBB(8) OOBB(9)];
mat1 = eulerAnglesToRotation3d(deg,axes);
rotMatNew = inv(mat1);
ptCloudNew.Location = transformPoint3d(pcZeroCentered, rotMatNew);
The reorientation yaw, pitch and roll angles are:
Figure 2,
OOBB2 = 2.9106 1.5406 -3.3209 223.5262 215.7089 54.8219 -0.0000 0.0000 0.0000
Figure 4,
OOBB4 = -2.8909 -0.9726 5.6143 283.9288 286.8387 62.4261 -134.6658 -0.0000 0.0000
Output figures after re-orientation are below. They should reorient similar to figures 1 and 3 (by planes). But what I am getting is totally different.
How do get aligned point clouds to figure 1 and 3 that are reoriented parallel to XY, YZ, and XZ planes?
@dlegland, Please help. I need to fix this soon to get a project going.