MATLAB Answers

how to use bundleAdjustment function in matlab

17 views (last 30 days)
Umberto Fontana
Umberto Fontana on 26 Jan 2018
Hi, I want to refine my cameras pose and world points in matlab, so I tried to apply the bundle adjustment method. Here is the code:
lim = 5; % numero di immagini da leggere
Orientation = cell(lim,1);
Location = cell(lim,1);
ViewIdFoo = uint32([]);
points2d = {zeros(lim,2)};
for i=1:lim
id = num2str(i);
im_name = strcat(id,'.png');
im = imread(im_name);
[imagePoints, boardSize,imagesUsed] = detectCheckerboardPoints(im);
worldPoints = generateCheckerboardPoints(boardSize, 0.8723);
% worldPoints(:,3) = 0;
for j=1:length(imagePoints(:,1))
% pTrack(i) = pointTrack(i,imagePoints);
[R,t] = extrinsics(imagePoints, worldPoints, calibrationSession.CameraParameters)
% t=t';
Orientation(i) = mat2cell(R,3);
Location(i) = mat2cell(t,1);
for h=1:length(imagePoints(:,1))
ViewId = ViewIdFoo';
cameraPoses = table(ViewId,Orientation,Location);
worldPoints(:,3) = 0;
[xyzRefinedPoints,refinedPoses]= bundleAdjustment(worldPoints,pTrack,cameraPoses,calibrationSession.CameraParameters)
So my idea is to detect the world points from a checkerboard and moving the camera refine the poses, but the output of the code is very different from the extrinsic parameters estimate withe the proper function.
Could someone help me with my problem? Is there any error in defining the points?
Thank you

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by