91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

使用OpenCV3.0進(jìn)行雙目三維重建。 代碼是用VS2013寫的,OpenCV版本為3.0且包含擴(kuò)展部分,如果不使用SIFT特征,可以修改源代碼,然后使用官方未包含擴(kuò)展部分的庫。軟件運(yùn)行后會將三維重建的結(jié)果寫入Viewer目錄下的structure.yml文件中,在Viewer目錄下有一個SfMViewer程序,直接運(yùn)行即可讀取yml文件并顯示三維結(jié)構(gòu)。

資源截圖

代碼片段和文件信息

#include?
#include?
#include?
#include?
#include?

using?namespace?cv;
using?namespace?std;

void?extract_features(
vector&?image_names
vector>&?key_points_for_all
vector&?descriptor_for_all
vector>&?colors_for_all

{
key_points_for_all.clear();
descriptor_for_all.clear();
Mat?image;

//讀取圖像,獲取圖像特征點(diǎn),并保存
Ptr?sift?=?xfeatures2d::SIFT::create(0?3?0.04?10);
for?(auto?it?=?image_names.begin();?it?!=?image_names.end();?++it)
{
image?=?imread(*it);
if?(image.empty())?continue;

vector?key_points;
Mat?descriptor;
//偶爾出現(xiàn)內(nèi)存分配失敗的錯誤
sift->detectAndCompute(image?noArray()?key_points?descriptor);

//特征點(diǎn)過少,則排除該圖像
if?(key_points.size()?<=?10)?continue;

key_points_for_all.push_back(key_points);
descriptor_for_all.push_back(descriptor);

vector?colors(key_points.size());
for?(int?i?=?0;?i? {
Point2f&?p?=?key_points[i].pt;
colors[i]?=?image.at(p.y?p.x);
}
colors_for_all.push_back(colors);
}
}

void?match_features(Mat&?query?Mat&?train?vector&?matches)
{
vector>?knn_matches;
BFMatcher?matcher(NORM_L2);
matcher.knnMatch(query?train?knn_matches?2);

//獲取滿足Ratio?Test的最小匹配的距離
float?min_dist?=?FLT_MAX;
for?(int?r?=?0;?r? {
//Ratio?Test
if?(knn_matches[r][0].distance?>?0.6*knn_matches[r][1].distance)
continue;

float?dist?=?knn_matches[r][0].distance;
if?(dist? }

matches.clear();
for?(size_t?r?=?0;?r? {
//排除不滿足Ratio?Test的點(diǎn)和匹配距離過大的點(diǎn)
if?(
knn_matches[r][0].distance?>?0.6*knn_matches[r][1].distance?||
knn_matches[r][0].distance?>?5?*?max(min_dist?10.0f)

continue;

//保存匹配點(diǎn)
matches.push_back(knn_matches[r][0]);
}
}

bool?find_transform(Mat&?K?vector&?p1?vector&?p2?Mat&?R?Mat&?T?Mat&?mask)
{
//根據(jù)內(nèi)參矩陣獲取相機(jī)的焦距和光心坐標(biāo)(主點(diǎn)坐標(biāo))
double?focal_length?=?0.5*(K.at(0)?+?K.at(4));
Point2d?principle_point(K.at(2)?K.at(5));

//根據(jù)匹配點(diǎn)求取本征矩陣,使用RANSAC,進(jìn)一步排除失配點(diǎn)
Mat?E?=?findEssentialMat(p1?p2?focal_length?principle_point?RANSAC?0.999?1.0?mask);
if?(E.empty())?return?false;

double?feasible_count?=?countNonZero(mask);
cout?< //對于RANSAC而言,outlier數(shù)量大于50%時,結(jié)果是不可靠的
if?(feasible_count?<=?15?||?(feasible_count?/?p1.size())? return?false;

//分解本征矩陣,獲取相對變換
int?pass_count?=?recoverPose(E?p1?p2?R?T?focal_length?principle_point?mask);

//同時位于兩個相機(jī)前方的點(diǎn)的數(shù)量要足夠大
if?(((double)pass_count)?/?feasible_count? return?false;

return?true;
}

void?get_matched_points(
vector&?p1?
vector&?p2?
vec

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????6363282??2008-09-17?15:42??0004.png
?????文件?????6365922??2008-09-17?15:43??0006.png
?????文件????????7030??2015-09-02?13:55??main.cpp
?????文件?????????898??2015-09-02?10:26??OpenCV_3_ex_x86.props
?????文件?????????903??2015-09-02?10:26??OpenCV_3_ex_x86d.props
?????目錄???????????0??2015-09-02?14:23??Release\
?????文件?????1822930??2015-09-02?14:23??Release\main.obj
?????文件???????44032??2015-09-02?14:23??Release\SequentialSfM.exe
?????文件????????2995??2015-09-02?14:23??Release\SequentialSfM.log
?????文件?????1200128??2015-09-02?14:23??Release\SequentialSfM.pdb
?????目錄???????????0??2015-09-02?14:23??Release\SequentialSfM.tlog\
?????文件?????????684??2015-09-02?14:23??Release\SequentialSfM.tlog\cl.command.1.tlog
?????文件???????18298??2015-09-02?14:23??Release\SequentialSfM.tlog\CL.read.1.tlog
?????文件?????????278??2015-09-02?14:23??Release\SequentialSfM.tlog\CL.write.1.tlog
?????文件????????1644??2015-09-02?14:23??Release\SequentialSfM.tlog\link.command.1.tlog
?????文件????????4204??2015-09-02?14:23??Release\SequentialSfM.tlog\link.read.1.tlog
?????文件?????????328??2015-09-02?14:23??Release\SequentialSfM.tlog\link.write.1.tlog
?????文件?????????165??2015-09-02?14:23??Release\SequentialSfM.tlog\SequentialSfM.lastbuildstate
?????文件??????888832??2015-09-02?14:23??Release\vc120.pdb
?????文件?????????971??2015-09-01?19:18??SequentialSfM.sln
?????文件????????4187??2015-09-01?19:37??SequentialSfM.vcxproj
?????文件?????????956??2015-09-01?19:22??SequentialSfM.vcxproj.filters
?????目錄???????????0??2015-09-02?12:59??Viewer\
?????文件?????4627456??2014-09-09?18:03??Viewer\Assimp32.dll
?????目錄???????????0??2015-09-02?12:58??Viewer\data\
?????文件???????????0??2014-09-09?18:03??Viewer\data\.gitkeep
?????文件??????289280??2014-09-09?18:03??Viewer\fmodex.dll
?????文件??????330752??2014-09-09?18:03??Viewer\fmodexL.dll
?????文件?????2713600??2014-09-09?18:03??Viewer\FreeImage.dll
?????文件??????364726??2014-09-09?18:03??Viewer\FreeType-6.dll
?????文件??????237568??2014-09-09?18:03??Viewer\glut32.dll
............此處省略7個文件信息

評論

共有 條評論