PointCloud issues with location XYZ

3 views (last 30 days)
Hi.
I'm trying to use a program that requires the extraction of data from two consecutive images of a room and then creating a pointCloud of the room, like a world scene. In fact, it's very similar to programs that I found in the internet, which used the preinstalled data file 'livingRoom.mat', in the Computer Vision Toolbox. However, I'm trying to do the same thing but with photos taken by my webcam, and I am having trouble with the pointCloud function. I already stored a number of consecutive pictures into one .mat file, so I believe the problem lies within the pointCloud creation itself. Here's my piece of code:
dataFile = fullfile('C:\','Program Files (x86)','Intel RealSense SDK 2.0','matlab','+realsense','teste_sala_novo.mat');
load(dataFile);
% the variable name extracted by the datafile is II
image_to_ref = II{1};
image_to_current = II{2};
color_matrix = reshape(image_to_ref,720,1280,3);
image_to_ref_1 = im2double(image_to_ref);
image_to_current_1 = im2double(image_to_current);
ptCloudRef = pointCloud(image_to_ref_1,'Color',color_matrix);
ptCloudCurrent = pointCloud(image_to_current_1,'Color',color_matrix);
I believe that this is logically okay, but I'm concerned that the conversion between uint8 and double (or single, I have already tried them both) causes some sort of information loss, resulting in pointClouds with always the same X,Y and Z limits, such as below shown:
I don't know how to fix this, I tried to take pictures with a digital camera, and I tried to use pictures from the internet, and this always happens. Furthermore, this results in a world scene quite weird:
Appreciate the help. Thanks in advance.

Answers (1)

Shashank Gupta
Shashank Gupta on 3 Feb 2021
Hi,
Can you attach one of the sample file for me to investigate. But my first guess looking at the data would be, you might have performed some sorts of normalization because of 0-1 number. Can you check if by mistake you normalized sLocation property of point clouds. Just checked the location array once. That should be first step of approaching this problem.
I hope this helps.
Cheers.
  3 Comments
Shashank Gupta
Shashank Gupta on 5 Feb 2021
Hi,
I am not sure why double() funciton is not working. I just tried on one example file it works on point cloud data. I am not really sure what's the problem in your case. Share a sample data file may be for me to check whether it can be imported and converted in to required data format you needed.
Tiago Batanete Marques
Tiago Batanete Marques on 18 Feb 2021
Hi,
Thanks for the quick answer, and I apologize for the delay in my response. I have failed to find the error, I tried to investigate further the functions but the problem kept surfacing. Here you have the sample file.
Thanks in advance.

Sign in to comment.

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!