D = importdata(strcat(folder_name, 'measurement_matrix.txt'));
%centering [m, n] = size(D); norm_D = zeros(m, n); for i = 1:m norm_D(i,:) = D(i,:) - mean(D(i,:)); end
[U, S, V] = svd(norm_D); U3 = U(:, 1:3); W3 = S(1:3, 1:3); V3 = V'; V3 = V3(1:3, :); M = U3*W3^(1/2); S = W3^(1/2)*V3;
figure() plot3(S(3,:),S(2,:),S(1,:), '.');
estimated_D = MS; per_frame_residual = zeros(m/2, 1); for i = 1:m/2 for j = 1:n per_frame_residual(i,1) = per_frame_residual(i,1) + ... sqrt(sumsqr(estimated_D(2i-1:2i, j) - norm_D(2i-1:2*i, j))); end end
selected_frame = [1,50,100]; for i = 1:size(selected_frame, 2) index = selected_frame(i); file_name = strcat(folder_name, 'frame00000', num2str(index, '%.3d'), '.jpg'); I = imread(file_name); figure() imshow(I); hold on;
scatter(D(2*index-1, :), D(2*index, :), 'r*');
scatter(estimated_D(2*index-1, :) + mean(D(2*index-1,:)) ...
, estimated_D(2*index, :) + mean(D(2*index,:)), 'go');
title(strcat('Frame', num2str(index)))
end
disp('total residual:'); disp(sum(per_frame_residual));
figure() plot(per_frame_residual); axis([0 101 0 400]); title('Residuals (per frame) ') xlabel('frame number'); ylabel('residules');
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.