Problem with updateLimitsAndDirection function
15 views (last 30 days)
Show older comments
Good afternoon,
I'm using MATLAB's Visual SLAM with RGB-D Camera example ( https://uk.mathworks.com/help/vision/ug/visual-slam-with-an-rgbd-camera.html ), and I got this error message:
"Error using worldpointset/updateLimitsAndDirection
Invalid location for world point 1. It coincides with one of the views that observes the world point."
When I am exercuting this line of code:
mapPointSet = updateLimitsAndDirection(mapPointSet, rgbdMapPointsIdx, vSetKeyFrames.Views);
In:
% Create an empty imageviewset object to store key frames
vSetKeyFrames = imageviewset;
% Create an empty worldpointset object to store 3-D map points
mapPointSet = worldpointset;
% Add the first key frame
vSetKeyFrames = addView(vSetKeyFrames, currKeyFrameId, initialPose, Points=currPoints,...
Features=currFeatures.Features);
% Add 3-D map points
[mapPointSet, rgbdMapPointsIdx] = addWorldPoints(mapPointSet, xyzPoints);
% Add observations of the map points
mapPointSet = addCorrespondences(mapPointSet, currKeyFrameId, rgbdMapPointsIdx, validIndex);
% Update view direction and depth
mapPointSet = updateLimitsAndDirection(mapPointSet, rgbdMapPointsIdx, vSetKeyFrames.Views);
In the example code, I've just modified the download and browse part of the input image sequence.
The code I've added is as follows:
% Select the synchronized image data
Path_RGB = 'C:\Documents\2.5\RGB camera\Image for bad of words\RGB';
Path_Grey = 'C:\Documents\2.5\RGB camera\Image for bad of words\Depth';
imdsColor = imageDatastore(Path_RGB);
imdsDepth = imageDatastore(Path_Grey);
% imdsColor = subset(imdsColor, indexPairs(:, 1));
% imdsDepth = subset(imdsDepth, indexPairs(:, 2));
% Inspect the first RGB-D image
currFrameIdx = 1;
currIcolor = readimage(imdsColor, currFrameIdx);
currIdepth = readimage(imdsDepth, currFrameIdx);
currIdepth = rgb2gray(currIdepth);
[rows, colums] = size(currIdepth);
currIcolor = imresize(currIcolor, [rows colums]);
imshowpair(currIcolor, currIdepth, "montage");
I am using MATLAB R2023b, and I've done some research on the Internet, but I haven't found a solution. Can you help me?
Thank you very much.
2 Comments
dpb
on 2 Oct 2024
Had you gone through all the preceding steps with the example before getting to that point? If so, since it appears to be an example from the Mathworks documentation, it's worth of an official support request...that's a whole lot of stuff to wade through for any of the volunteer folks here at the forum to try to ferret out an issue...
Answers (1)
Gayathri
on 28 Oct 2024
I understand that you are facing the error "Error using worldpointset/updateLimitsAndDirection. Invalid location for world point 1. It coincides with one of the views that observes the world point" when running the “Visual SLAM with RGB-D Camera” MATLAB example on your dataset.
The error occurs as one of the “world point” coincides with one of the camera locations. As I do not have access to the input data, I was not able to reproduce the issue. But from what I understand, please ensure that the intrinsic values like “focal length”, “principalPoint”, and “depthFactor” are updated to match your dataset as this might affect the values generated in “mapPointSet”. Incorrect values for these parameters can cause errors in the projection model of the camera. This means that the calculated 3D positions of points may not align correctly with the camera's actual view, potentially leading to situations where a 3D point appears to coincide with a camera location.
In addition, please ensure that the “bofData” also matches with your dataset.
For more information on the “Visual SLAM with RGB-D Camera” MATLAB example, please refer to the below link. https://www.mathworks.com/help/releases/R2023b/vision/ug/visual-slam-with-an-rgbd-camera.html
The dataset used in the “Visual SLAM with RGB-D Camera” MATLAB can be accessed using the below mentioned link.
The intrinsics of the dataset such as “focalLength”, “principalPoint” can be found in the below mentioned link.
Hope you find this information helpful.
See Also
Categories
Find more on Point Cloud Processing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!