Skip to content
## Notes
Notes from Rohan:
- could use MATLAB coder to move MATLAB code to C/C++ code
- not sure if this is possible for Java code as well
- Prof. mentioned wanting Java code s.t. other students can read and critique codebase
- use MATLAB functions, create new MATLAB objects for data structures / database system
- dataset used by MATLAB example: https://cvg.cit.tum.de/data/datasets/rgbd-dataset
#### Performing VSLAM using online dataset
- Open up MATLAB console
- Install necessary Mathworks Library: Vision, Visual SLAM (users will be queried to download necessary packages)
- In MATLAB console, set imagesPath to 'rgbd_dataset_freiburg3_long_office_household/rgb'
- Run the vslam_implementation.m script with the imagesPath as input
- Use output of worldPointSet for figuring out which key features belong to which objects
function extractPointsByViewId(viewId, worldPointSet)
% Define directories and file paths
% keyFramesDir = './KeyFrames';
keyFramePointsDir = './KeyFramePoints';
% Construct filename for the image
% imageFilename = sprintf('%s/KeyFrame_%04d.png', keyFramesDir, viewId);
% Load and display the image
% currImage = imread(imageFilename);
% figure;
% imshow(currImage);
% title(['Image for View ID: ', num2str(viewId)]);
% hold on;
% Load corresponding CSV file for world point indices and pixel locations
csvFilename = sprintf('%s/KeyFramePoints_%04d.csv', keyFramePointsDir, viewId);
dataMatrix = readmatrix(csvFilename);
% Extract pixel locations and indices of world points
% pixelLocations = dataMatrix(:, 1:2); % Assuming first two columns are pixel X, Y
mapPointsIdx = dataMatrix(:, 3); % Assuming third column is mapPointsIdx
% Extract world points using the indices
worldPoints = worldPointSet.WorldPoints(mapPointsIdx, :);
% Append world points to the CSV
updatedDataMatrix = [dataMatrix, worldPoints]; % Concatenate world points
writematrix(updatedDataMatrix, csvFilename); % Write it back
% % Overlay features on the image
% plot(pixelLocations(:,1), pixelLocations(:,2), 'yo', 'MarkerSize', 5, 'LineWidth', 2);
%
% % Optionally save or display the image
% figure;
% imshow(currImage);
% hold on;
% plot(pixelLocations(:,1), pixelLocations(:,2), 'yo', 'MarkerSize', 5, 'LineWidth', 2);
% title('Features Overlayed on Image');
end
Class,Confidence,X,Y,Width,Height
sofa,0.952328,54,305,439,174
Class,Confidence,X,Y,Width,Height
sofa,0.965473,-12,307,437,171
sofa,0.592514,576,322,64,156
Class,Confidence,X,Y,Width,Height
sofa,0.982908,-5,315,358,164
sofa,0.981918,456,338,185,141
Class,Confidence,X,Y,Width,Height
sofa,0.988577,-4,315,313,163
sofa,0.982338,403,332,238,149
Class,Confidence,X,Y,Width,Height
sofa,0.986512,-5,323,282,154
sofa,0.969826,383,327,255,151
Class,Confidence,X,Y,Width,Height
sofa,0.975408,325,327,314,150
sofa,0.912207,1,332,220,146
Class,Confidence,X,Y,Width,Height
sofa,0.886575,297,272,338,149
sofa,0.845557,0,268,195,209
Class,Confidence,X,Y,Width,Height
sofa,0.965334,267,213,370,144
sofa,0.519108,0,207,155,272
Class,Confidence,X,Y,Width,Height
sofa,0.972942,229,199,395,152
diningtable,0.634724,353,337,288,143
Class,Confidence,X,Y,Width,Height
sofa,0.978026,232,181,393,170
diningtable,0.623284,389,315,249,168
Class,Confidence,X,Y,Width,Height
sofa,0.976634,231,199,391,180
Class,Confidence,X,Y,Width,Height
sofa,0.962698,346,202,293,186
Class,Confidence,X,Y,Width,Height
sofa,0.869272,478,191,160,208
Class,Confidence,X,Y,Width,Height
sofa,0.786228,510,187,130,210
Class,Confidence,X,Y,Width,Height
sofa,0.710312,535,181,104,211
sofa,0.671818,-11,171,481,303