xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

資源簡(jiǎn)介

Windows環(huán)境使用VS2017編譯opencv-4.2.0和opencv_contrib-4.2.0源碼,支持TBB
包含x86和x64
https://blog.csdn.net/libaineu2004/article/details/104252289

資源截圖

代碼片段和文件信息

//?cv420test.cpp?:?此文件包含?“main“?函數(shù)。程序執(zhí)行將在此處開(kāi)始并結(jié)束。
//

#include?
#include?
#include?
//原文鏈接:https://blog.csdn.net/libaineu2004/article/details/104252289

int?main()
{
cv::Mat?imageL?=?cv::imread(“origin_1.jpg“);
cv::Mat?imageR?=?cv::imread(“origin_2.jpg“);
/*imshow(“1“?imageL);
imshow(“2“?imageR);
waitKey();
return?0;*/

//提取特征點(diǎn)方法
//SIFT
cv::Ptr?sift?=?cv::xfeatures2d::SIFT::create();
//ORB
//cv::Ptr?orb?=?cv::ORB::create();
//SURF
//cv::Ptr?surf?=?cv::xfeatures2d::SURF::create();

//特征點(diǎn)
std::vector?keyPointL?keyPointR;
//單獨(dú)提取特征點(diǎn)
sift->detect(imageL?keyPointL);
sift->detect(imageR?keyPointR);

//畫特征點(diǎn)
cv::Mat?keyPointImageL;
cv::Mat?keyPointImageR;
drawKeypoints(imageL?keyPointL?keyPointImageL?cv::Scalar::all(-1)?cv::DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
drawKeypoints(imageR?keyPointR?keyPointImageR?cv::Scalar::all(-1)?cv::DrawMatchesFlags::DRAW_RICH_KEYPOINTS);

//顯示窗口
cv::namedWindow(“KeyPoints?of?imageL“);
cv::namedWindow(“KeyPoints?of?imageR“);

//顯示特征點(diǎn)
cv::imshow(“KeyPoints?of?imageL“?keyPointImageL);
cv::imshow(“KeyPoints?of?imageR“?keyPointImageR);

//特征點(diǎn)匹配
cv::Mat?despL?despR;
//提取特征點(diǎn)并計(jì)算特征描述子
sift->detectAndCompute(imageL?cv::Mat()?keyPointL?despL);
sift->detectAndCompute(imageR?cv::Mat()?keyPointR?despR);

//Struct?for?DMatch:?query?descriptor?index?train?descriptor?index?train?image?index?and?distance?between?descriptors.
//int?queryIdx?–>是測(cè)試圖像的特征點(diǎn)描述符(?descriptor?)的下標(biāo),同時(shí)也是描述符對(duì)應(yīng)特征點(diǎn)(keypoint)的下標(biāo)。
//int?trainIdx?–>?是樣本圖像的特征點(diǎn)描述符的下標(biāo),同樣也是相應(yīng)的特征點(diǎn)的下標(biāo)。
//int?imgIdx?–>當(dāng)樣本是多張圖像的話有用。
//float?distance?–>代表這一對(duì)匹配的特征點(diǎn)描述符(本質(zhì)是向量)的歐氏距離,數(shù)值越小也就說(shuō)明兩個(gè)特征點(diǎn)越相像。
std::vector?matches;

//如果采用?flannbased?方法?那么?desp通過(guò)orb的到的類型不同需要先轉(zhuǎn)換類型
if?(despL.type()?!=?CV_32F?||?despR.type()?!=?CV_32F)
{
despL.convertTo(despL?CV_32F);
despR.convertTo(despR?CV_32F);
}

cv::PtrriptorMatcher>?matcher?=?cv::DescriptorMatcher::create(“Flannbased“);
matcher->match(despL?despR?matches);

//計(jì)算特征點(diǎn)距離的最大值
double?maxDist?=?0;
for?(int?i?=?0;?i? {
double?dist?=?matches[i].distance;
if?(dist?>?maxDist)
maxDist?=?dist;
}

//挑選好的匹配點(diǎn)
std::vector?good_matches;
for?(int?i?=?0;?i? {
if?(matches[i].distance? {
good_matches.push_back(matches[i]);
}
}

cv::Mat?imageOutput;
cv::drawMatches(imageL?keyPointL?imageR?keyPointR?good_matches?imageOutput);

cv::namedWindow(“picture?of?matching“);
cv::imshow(“picture?of?matching“?imageOutput);
cv::waitKey(0);

return?0;
}

//?運(yùn)行程序:?Ctrl?+?F5?或調(diào)試?>“開(kāi)始執(zhí)行(不調(diào)試)”菜單
//?調(diào)試程序:?F5?或調(diào)試?>“開(kāi)始調(diào)試”菜單

//?入門使用技巧:
//???1.?使用解決方案資源管理器窗口添加/管理文件
//???2.?使用團(tuán)隊(duì)資源管理器窗口連接到源代碼管理
//???3.?使用輸出窗口查看生成輸出和其他消息
//???4.?使用錯(cuò)誤列表窗口查看錯(cuò)誤
//???5.?轉(zhuǎn)到“項(xiàng)目”>“添加新項(xiàng)”以創(chuàng)建新的代碼文件,或轉(zhuǎn)到“項(xiàng)目”>“添加現(xiàn)有項(xiàng)”以將現(xiàn)有代碼文件添加到項(xiàng)目
//???6.?將來(lái),若要再次打開(kāi)此項(xiàng)目,請(qǐng)轉(zhuǎn)到“文件”>“打開(kāi)”>“項(xiàng)目”并選擇?.sln?文件

評(píng)論

共有 條評(píng)論