how to use bundleAdjustment function in matlab

1 次查看(过去 30 天)
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
ViewIdFoo(i)=i;
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;
load('mobiling_3_n_10.mat');
for j=1:length(imagePoints(:,1))
points2d{j}(i,1)=imagePoints(j,1);
points2d{j}(i,2)=imagePoints(j,2);
end
% pTrack(i) = pointTrack(i,imagePoints);
[R,t] = extrinsics(imagePoints, worldPoints, calibrationSession.CameraParameters)
% t=t';
Orientation(i) = mat2cell(R,3);
Location(i) = mat2cell(t,1);
end
for h=1:length(imagePoints(:,1))
pTrack(h)=pointTrack(ViewIdFoo(),points2d{h});
end
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

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Support Package for USB Webcams 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by