资源简介
这个是计算机视觉三维重建的领域。该代码实现特征点提取和立体匹配的功能。三维重建模拟人眼,进行双目拍摄。这里在经典特征点特区SURF算法基础上,加入极线约束的思想,去除噪声和匹配错误的杂点。有很好的匹配效果。
代码片段和文件信息
// 多种特征提取.cpp : 定义控制台应用程序的入口点。
//
//#include “stdafx.h“
#include
#include
#include “opencv2/opencv.hpp“
#include “opencv2/core/core.hpp“
#include “opencv2/features2d/features2d.hpp“
#include “opencv2/highgui/highgui.hpp“
#include “opencv2/legacy/legacy.hpp“ // 暴力匹配的头文件
#include “opencv2/nonfree/nonfree.hpp“
#include
#include
//#include “cv_import_static_lib.h“
using namespace std;
using namespace cv;
void main(){
Mat img1 = imread(“左1.jpg“ CV_LOAD_IMAGE_GRAYSCALE);
Mat img2 = imread(“右1.jpg“ CV_LOAD_IMAGE_GRAYSCALE);
Mat img_1 img_2;
resize(img1 img_1 Size(img1.cols / 4 img1.rows / 4) 0 0 INTER_LINEAR);
resize(img2 img_2 Size(img2.cols / 4 img2.rows / 4) 0 0 INTER_LINEAR);
if (!img_1.data || !img_2.data)
{
cout << “error reading images “ << endl;
return;
}
vector keyPoints_1 keyPoints_2;
Mat descriptors_1 descriptors_2;
/*-----------------SIFT featrue Point----------------
SIFT sift;
sift(img_1 Mat() keyPoints_1 descriptors_1);
sift(img_2 Mat() keyPoints_2 descriptors_2);
*/
/*-----------------SURF featrue Point----------------
SURF surf;
surf(img_1 Mat() keyPoints_1 descriptors_1);
surf(img_2 Mat() keyPoints_2 descriptors_2);
//SurfDescriptorExtractor extrator; // another surf sift operation
//extrator.compute(img_1 keyPoints_1 descriptors_1);
//extrator.compute(img_2 keyPoints_2 descriptors_2);
*/
//-----------------ORB featrue Point----------------
ORB orb; // float Feature can not use Flannbase Match.
orb(img_1 Mat() keyPoints_1 descriptors_1);
orb(img_2 Mat() keyPoints_2 descriptors_2);
/*-----------------ORB featrue Point----------------
MSER mesr;
*/
/*-----------------FAST featrue Point----------------
FastFeatureDetector fast1(100); // 检测的阈值为40
FastFeatureDetector fast2(100);
fast1.detect(img_1 keyPoints_1);
fast2.detect(img_2 keyPoints_2);
//SurfDescriptorExtractor extrator; // another surf sift operation
//extrator.compute(img_1 keyPoints_1 descriptors_1);
//extrator.compute(img_2 keyPoints_2 descriptors_2);
OrbDescriptorExtractor extrator;
extrator.compute(img_1 keyPoints_1 descriptors_1);
extrator.compute(img_2 keyPoints_2 descriptors_2);
*/
BruteForceMatcher matcher;// orb 等float型的
//FlannbasedMatcher matcher; // 只能 对uchar的点进行匹配
vector< DMatch > matches;
matcher.match(descriptors_1 descriptors_2 matches);
double max_dist = 0; double min_dist = 100;
//-- Quick calculation of max and min distances between keypoints
for (int i = 0; i < descriptors_1.rows; i++)
{
double dist = matches[i].distance;
if (dist < min_dist) min_dist = dist;
if (dist > max_dist) max_dist = dist;
}
cout << “-- Max dist :“ << max_dist << endl;
cout << “-- Min dist :“ << min_dist << endl;
//-- Draw only “good“ matches (i.e. whose
- 上一篇:黑客帝国C语言
- 下一篇:ZhajingHua.cpp
相关资源
- 三维重建VC++
- surf特征提取与匹配
- SURF特征点检测 程序 by浅墨
- 基于边缘梯度的模板匹配算法
- 基于SURF的特征检测程序 VC6.0下可以直
- 三维重建代码合集.zip
- PMVS三维重建
- 杨淑英VC++图像处理程序设计配套光盘
- 双目视觉三维重建
- 肺部CT图像分割及重建系统
- 应用opencv库项目(Visual Studioc++)的
- OpenCV算法精解 基于Python与C++
- c++读取JPG图片,完成计算机视觉中的
- sift-surf-orb通用程序
- kinect+openGL+openNI+opencv实现三维重建
- surfsift算法配准,利用Ransac去除误匹配
- opencv实现surf算法
- VTK医学图像三维重建
- VTK源码,读取obj、stl点云,生成重建
- isosurface
- surf+ransac匹配
- 基于opencv的C++人眼识别以及眨眼检测
- 在VS2012上基于opencv的C++人眼识别与眨
- 基于C#平台开发的surf算法,可直接运
- Frankot and Chellappa算法
- SURF源码 win C++
- 点云PCL三维重建
- 基于八叉树分解的三维重建
- OpenCV-OpenGL--Reconstuction3d三维重建
评论
共有 条评论