1.完整项目描述和程序获取
>面包多安全交易平台:https://mbd.pub/o/bread/ZJeckppx
>如果链接失效,可以直接打开本站店铺搜索相关店铺:
>如果链接失效,程序调试报错或者项目合作也可以加微信或者QQ联系。
2.部分仿真图预览
3.算法概述
三维点云室内重建是计算机视觉领域的一个重要研究方向,它可以为现实世界中的建筑空间提供高精度的三维模型。在这个领域中,SURF+AFFINE+RANSAC+ICP算法是一种常用的方法。
4.部分源码
.........................................................
for i = 2:num_images
%加载下一个RGB和深度图像
[im2, d_img2] = load_images(i,imglistrgb,imglistdepth);
% SURF
[f2, vp2] = extractFeatures(rgb2gray(im2), detectSURFFeatures(rgb2gray(im2), 'MetricThreshold', SURF_threshold));
[idxPairs, ~] = matchFeatures(f1, f2);
p1 = double(vp1(idxPairs(:,1),:).Location); % [u1 v1]
p2 = double(vp2(idxPairs(:,2),:).Location); % [u2 v2]
%RGB图像2平面中的投影深度
[d_pos2, img2_pixels] = from_depth_to_RGB(d_img2,cam_params,rows,cols);
%使用NN为每个图像查找对应的3D点
[xyz_1] = match_2D_to_3D(img1_pixels, p1, d_pos1);
[xyz_2] = match_2D_to_3D(img2_pixels, p2, d_pos2);
%RANSAC(仿射)
num_SURF_matches = length(xyz_1);
max_inliers = 0;
SURF_pts = [xyz_1; xyz_2];
%RANSAC环路
........................................................................
%ICP迭代
for j = 1 : icp_num_iter
%将缩小后的图像2的点转换为图像1参考帧
xyz_pos2_in_1 = H_total*[d_pos2_red; ones(1, size(d_pos2_red, 2))];
xyz_pos2_in_1(4, :) = [];
%在图像1参考系中查找缩小图像2的最近点
xyz_pos1 = match_2D_to_3D(d_pos1, xyz_pos2_in_1', d_pos1);
%每个点的计算机错误
e_icp = (xyz_pos1 - xyz_pos2_in_1).*(xyz_pos1 - xyz_pos2_in_1);
e_icp = sqrt(sum(e_icp));
%移除距离较远的最近邻居
xyz_pos1(:, e_icp > e ) = [];
xyz_pos2_in_1(:, e_icp > e ) = [];
[R_icp, T_icp] = procrustes(xyz_pos1, xyz_pos2_in_1);
H_total = [R_icp T_icp; 0 0 0 1]\H_total;
end
end
% H transform %
aux_H{i,i} = eye(4);
for k = 1:i-1
aux_H{k,i} = H_total\aux_H{k,i-1};
aux_H{i,k} = inv(aux_H{k,i});
end
%Update
img1_pixels = img2_pixels;
d_pos1 = d_pos2;
f1 = f2;
vp1 = vp2;
end
for i = 1:num_images
transforms{i}.R = aux_H{i, 1}(1:3, 1:3);
transforms{i}.T = aux_H{i, 1}(1:3, 4);
end
end
A696