Error in Monocular Visual Simultaneous Localization and Mapping example

조회 수: 4 (최근 30일)
Sheraz Shamim
Sheraz Shamim 2023년 5월 20일
편집: Sheraz Shamim 2023년 5월 20일
Hi
I am running exampel of "Monocular Visual Simultaneous Localization and Mapping". I need to estimate pose (translational and orientation) of camera for my data images. I tried to extract relative pose and yaw pitch roll from "vSetKeyFrames" variable. I need to get pose information for each images. However for this example this compares all images with each other and creating many poses.
I need a csv or .xls file to have
1. 1x column for time (capture each poses),
2. 1x column for image id(each image name)
3. 3 x columns for Translation ( x y z poses)
4. 3x columns for yaw pitch roll (convert Rotation matrix each value to yaw pitch roll.
This column will then compares with gps data so i need time sequence for respective image id.
I add following lines after Loop Closure section.
% intialization
gg=0;hh=0;rr=0;
temp3=[];
temp4=[];
yaw_temp=[]; pitch_temp=[];roll_temp=[];hh=vSetKeyFrames.Connections(:,3);
% loop to extract translation relative pose and Rotation matrix and convert
% it to yar pitch roll
for i=1:size(hh)
gg=hh.RelativePose{i,1}.Translation;
rr=hh.RelativePose{i,1}.R;
% Extract yaw, pitch, and roll angles from the rotation matrix
yaw = atan2(rr(2,1), rr(1,1)); % Yaw angle (in radians)
yaw_temp=[yaw_temp;yaw];
pitch = atan2(-rr(3,1), sqrt(rr(3,2)^2 + rr(3,3)^2)); % Pitch angle (in radians)
pitch_temp=[pitch_temp;pitch];
roll = atan2(rr(3,2), rr(3,3)); % Roll angle (in radians)
roll_temp=[roll_temp;roll];
% Convert angles to degrees if desired
yaw_deg = rad2deg(yaw); % Yaw angle (in degrees)
pitch_deg = rad2deg(pitch); % Pitch angle (in degrees)
roll_deg = rad2deg(roll); % Roll angle (in degrees)
temp3=[temp3;gg];
temp4=[yaw_temp,pitch_temp,roll_temp];
end
Also I am gettign error on follwoing line for my custom images
% Optimize the poses
minNumMatchesTIME = 20;
[vSetKeyFramesOptim, poseScales] = optimizePoses(vSetKeyFrames, minNumMatchesTIME, Tolerance=1e-16);
minNumMatchesTIME error

답변 (0개)

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by