W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
本教程的目標(biāo)是學(xué)習(xí)如何使用features2d和calib3d模塊來檢測場景中已知的平面對象。
測試數(shù)據(jù):使用數(shù)據(jù)文件夾中的圖像,例如box.png和box_in_scene.png。
Mat img1 = imread(argv [1],IMREAD_GRAYSCALE);
Mat img2 = imread(argv [2],IMREAD_GRAYSCALE);
// detecting keypoints
Ptr<Feature2D> surf = SURF::create();
vector<KeyPoint> keypoints1;
Mat descriptors1;
surf->detectAndCompute(img1, Mat(), keypoints1, descriptors1);
... // do the same for the second image
// matching descriptors
BruteForceMatcher<L2<float> > matcher;
vector<DMatch> matches;
matcher.match(descriptors1, descriptors2, matches);
// drawing the results
namedWindow("matches", 1);
Mat img_matches;
drawMatches(img1, keypoints1, img2, keypoints2, matches, img_matches);
imshow("matches", img_matches);
waitKey(0);
vector<Point2f> points1, points2;
// fill the arrays with the points
....
Mat H = findHomography(Mat(points1), Mat(points2), RANSAC, ransacReprojThreshold);
Mat點1投影; 透視變換(Mat(points1),points1Projected,H);
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: