資源簡(jiǎn)介
基于增量式SfM實(shí)現(xiàn)多視圖三維點(diǎn)云重建,完整的工程文件,內(nèi)含所需圖片,可直接運(yùn)行。環(huán)境:Win10+VS2015+OpenCV3.4+PLC1.8。
代碼片段和文件信息
#ifndef?_CRT_SECURE_NO_WARNINGS
#define?_CRT_SECURE_NO_WARNINGS
#endif
#include?
#include?
#include?
#include??
#include?
#include?
#include?
#include?
using?namespace?std;
using?namespace?cv;
using?namespace?pcl;
using?namespace?cv::xfeatures2d;
//?提取所有圖像的特征點(diǎn)?及?特征點(diǎn)處的RGB
void?extract_features(vector&?image_names?vector>&?keypoints_for_all?vector&?descriptor_for_all?vector>&?colors_for_all);
//?ratio?&?symmetry?test
void?ratioTest(vector>?&matches?vector?&goodMatches);
void?symmetryTest(const?vector&?matches1?const?vector&?matches2?vector&?symMatches);
//?匹配所有特征點(diǎn)
void?match_features(vector&?descriptor_for_all?vector>&?matches_for_all);
//?由匹配對(duì)提取特征點(diǎn)對(duì)
void?get_matched_points(vector?keypoints1vector?keypoints2vector?goodMatchesvector&?points1vector&?points2);
//?獲取匹配點(diǎn)的RGB
void?get_matched_colors(vector&?color1?vector&?color2?vector?matches?vector&?out_c1?vector&?out_c2);
//?剔除p1中mask值為0的元素
void?maskout_points(vector&?p1?Mat&?mask);
void?maskout_colors(vector&?p1?Mat&?mask);
//?重建前2張圖片
void?reconstruct_first2imgs(Mat?K?vector>&?key_points_for_all?vector>&?colors_for_all?vector>&?matches_for_all?vector&?structure?vector>&?correspond_struct_idx?vector&?colors?vector&?rotations?vector&?translations);
//?三維重建
//?前兩張圖片重建
void?reconstruct(Mat&?K?vector&?points1?vector&?points2?Mat&?R?Mat&?t?Mat&?mask?vector&?points3D);
//?后續(xù)圖片重建
void?reconstruct(Mat&?K?Mat&?R1?Mat&?T1?Mat&?R2?Mat&?T2?vector&?points1?vector&?points2?vector&?points3D);
//?獲得三維點(diǎn)與對(duì)應(yīng)的像素點(diǎn)
void?get_objpoints_and_imgpoints(vector&?matches?vector&?struct_indices?vector&?structure?vector&?key_points?vector&?object_points?vector&?image_points);
//?點(diǎn)云融合
void?fusion_pointscloud(vector&?matches?vector&?struct_indices?vector&?next_struct_indices?vector&?structure?vector&?next_structure?vector&?colors?vector&?next_colors);
int?main(int?argc?char*?argv[])
{
vector?img_names;
img_names.push_back(“.\\images\\000.png“);
img_names.push_back(“.\\images\\001.png“);
img_names.push_back(“.\\images\\002.png“);
img_names.push_back(“.\\images\\003.png“);
img_names.push_back(“.\\images\\004.png“);
img_names.push_back(“.\\images\\005.png“);
//img_names.push_back(“.\\images\\006.png“);
//img_names.push_back(“.\\images\\007.png“);
//img_names.push_back(“.\\images\\008.pn
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-03-12?15:16??.vs\
?????目錄???????????0??2019-03-12?15:16??.vs\SfM\
?????目錄???????????0??2019-03-12?15:16??.vs\SfM\v14\
?????文件???????75264??2019-03-12?15:15??.vs\SfM\v14\.suo
?????文件????????1291??2019-03-04?13:13??SfM.sln
?????文件??????????52??2019-03-12?12:52??SfM.VC.VC.opendb
?????目錄???????????0??2019-03-12?15:17??SfM\
?????目錄???????????0??2019-03-12?15:16??SfM\images\
?????文件?????6047052??2018-04-22?08:33??SfM\images\000.png
?????文件?????6273917??2018-04-22?08:33??SfM\images\001.png
?????文件?????6382709??2018-04-22?08:33??SfM\images\002.png
?????文件?????6363282??2018-04-22?08:33??SfM\images\003.png
?????文件?????6340215??2018-04-22?08:33??SfM\images\004.png
?????文件?????6365922??2018-04-22?08:33??SfM\images\005.png
?????文件?????6262661??2018-04-22?08:33??SfM\images\006.png
?????文件?????6347685??2018-04-22?08:33??SfM\images\007.png
?????文件?????6481233??2018-04-22?08:33??SfM\images\008.png
?????文件?????6540372??2018-04-22?08:33??SfM\images\009.png
?????文件???????18557??2019-03-12?14:31??SfM\MultiView_Rec.cpp
?????文件????????4268??2019-03-03?22:01??SfM\SfM.cpp
?????文件????????7267??2019-03-12?15:05??SfM\SfM.vcxproj
?????文件?????????971??2019-03-12?15:05??SfM\SfM.vcxproj.filters
?????文件?????????165??2019-03-05?14:02??SfM\SfM.vcxproj.user
評(píng)論
共有 條評(píng)論