您当前的位置: 首页 >  矩阵

惊鸿一博

暂无认证

  • 2浏览

    0关注

    535博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

OpenCV_Find Basis F-Matrix and computeCorrespondEpilines(获取一对图像的基础矩阵及对应极线)

惊鸿一博 发布时间:2017-03-26 22:10:17 ,浏览量:2

Codes:

// BasisMatrixCalculate.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include  

#include 
#include 
#include 
#include 
//引用cv::KeyPoint 特征检测器通用接口
#include  
# include 
#include  //引用features2d.hpp中 SurfFeatureDetector
#include   
int main()
{
	//读取2张图像
	cv::Mat image1 = cv::imread("../../aTestImage/church01.jpg", 0);
	cv::Mat image2 = cv::imread("../../aTestImage/church03.jpg", 0);
	if (!image1.data || !image2.data)
		return 0;
	//使用SURF特征 获取图像特征点
	std::vector keyPoints1;
	std::vector keyPoints2;
	cv::SurfFeatureDetector surf(3000);
	surf.detect(image1, keyPoints1);
	surf.detect(image2, keyPoints2); //获取两幅图像的特征点

	// //展示图像中的keyPoints
	//cv::Mat imagekeyPt;
	//cv::drawKeypoints(image1, keyPoints1, imagekeyPt, cv::Scalar(255, 255, 255), cv::DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
	//cv::namedWindow("image1SURFkeyPt");
	//cv::imshow("image1SURFkeyPt", imagekeyPt);
	//cv::drawKeypoints(image2, keyPoints2, imagekeyPt, cv::Scalar(255, 255, 255), cv::DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
	//cv::namedWindow("image2SURFkeyPt");
	//cv::imshow("image2SURFkeyPt", imagekeyPt);

	//通过特征点获取描述子
	cv::SurfDescriptorExtractor  surfDesc;  // 构造描述子提取器
	cv::Mat descriptors1, descriptors2;  //描述子记录局部强度差值/梯度变化/位置等信息
	surfDesc.compute(image1, keyPoints1, descriptors1);
	surfDesc.compute(image2, keyPoints2, descriptors2);

	//匹配图像的描述子 descriptors
	cv::BruteForceMatcher< cv::L2 > matcher; //构造匹配器
	std::vector matches; //匹配描述子
	matcher.match(descriptors1, descriptors2, matches);
	std::cout             
关注
打赏
1663399408
查看更多评论
0.0352s