Kinect Point Cloud Floor is sloped compared to Walls

Hi
So I am using a kinect to get a point cloud and then for now I'm just saving it as a .ply
The issue is that the walls and floors are not at 90 degrees to each other
I get the pitch from the accelerometer so that I can rotate the whole point cloud to be level (for now assuming roll is zero)
But as you can see below, although the walls are pointing straight up, the floor looks sloped
I am pretty sure it's not the sensor itself because I have played around with KinectFusion and that worked perfectly fine
Here's a link to view the point cloud on SketchFab
(I have also attached the .ply to this post)
Thanks :)
Script:
%--------------------------------------------------------------------------
%INITIALISE KINECT
%--------------------------------------------------------------------------
clc;
disp('Capturing Point Cloud');
disp('----------------------------------');
imaqreset;
disp('Imaq Reset');
colourVid = videoinput('kinect',1);
disp('Colour Video Acquired');
src = getselectedsource(colourVid);
disp('Colour Video Source Acquired');
colourDevice = imaq.VideoDevice('kinect',1);
disp('Colour Device Acquired');
depthDevice = imaq.VideoDevice('kinect',2);
disp('Depth Device Acquired');
src.CameraElevationAngle = 0;
disp('Kinect Initialised');
%--------------------------------------------------------------------------
%CAPTURE POINT CLOUD
%--------------------------------------------------------------------------
src.CameraElevationAngle = -20;
colourImage = step(colourDevice);
depthImage = step(depthDevice);
ptCloud = pcfromkinect(depthDevice,depthImage,colourImage);
disp('Point Cloud Captured');
%--------------------------------------------------------------------------
%TRANSFORM POINT CLOUD
%--------------------------------------------------------------------------
pitch = atan(src.Accelerometer(3) / sqrt( (src.Accelerometer(1)*src.Accelerometer(1)) + (src.Accelerometer(2)*src.Accelerometer(2)) ) );
T = makehgtform('xrotate',pitch);
tform = affine3d(T);
ptCloudTransformed = pctransform(ptCloud,tform);
disp('Point Cloud Transformed');
%--------------------------------------------------------------------------
%SAVE POINT CLOUD AS PLY
%--------------------------------------------------------------------------
pcwrite(ptCloudTransformed,'TestPT.ply','Encoding','ascii');
disp('Point Cloud Saved');
%--------------------------------------------------------------------------
%CLEAN UP
%--------------------------------------------------------------------------
delete(colourVid);
release(colourDevice);
release(depthDevice);

Risposte (0)

Prodotti

Release

R2019a

Richiesto:

il 23 Ago 2019

Modificato:

il 23 Ago 2019

Community Treasure Hunt

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

Start Hunting!

Translated by