资源简介
ransac算法随机一致性采样方法被广泛应用于影像匹配中剔除匹配点对中的误配点对,效果明显,这段代码系网友所写,详细介绍了该方法的基本原理
代码片段和文件信息
/*************************************************************************
Copyright (c) 2008 The University of Western Ontario. All rights reserved.
Contributors:
* Islam Ali (Computer Science Department)
Redistribution and use in source and binary forms with or without
modification are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice this list of conditions and the following disclaimer listed
in this license in the documentation and/or other materials
provided with the distribution.
- Neither the name of the copyright holders nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
*************************************************************************/
#include
#include
#include “Ransac.h“
#include
using namespace std;
int main()
{
double** x1 = new double*[3];
double** x2 = new double*[3];
double** x1_inliers = new double*[3];
double** x2_inliers = new double*[3];
double** x1_outliers = new double*[3];
double** x2_outliers = new double*[3];
double** new_x1 = new double*[3];
double** new_x2 = new double*[3];
double** T1 = new double*[3];
double** T2 = new double*[3];
double** H = new double*[3];
double** H_temp= new double*[3]; //Temporary matrix for Homography denormalization
fstream in(“xy.txt“);
if(in.is_open())
{
//Read the Number and Location of the Features returned by SIFT
int nof;
in>>nof;
for(int i = 0; i < 3; i++)
{
x1[i] = new double[nof];
x2[i] = new double[nof];
}
for(int i=0; i in>> x1[1][i];
for(int i=0; i in>> x1[0][i];
for(int i=0; i x1[2][i] = 1;
for(int i=0; i in>> x2[1][i];
for(int i=0; i in>> x2[0][i];
for(int i=0; i x2[2][i] = 1;
for(int i = 0; i < 3; i++)
{
x1_inliers[i] = new double[nof];
x2_inliers[i] = new double[nof];
x1_outliers[i] = new double[nof];
x2_outliers[i] = new double[nof];
}
double t = 0.0001; //Define your RANSAC threshold
Ransac R1(x1x2noft);
for(int i = 0; i < 3; i++)
{
new_x1[i] = new double[nof];
new_x2[i] = new double[nof];
T1[i] = new double[3];
T2[i] = new double[3];
H[i] = new double[3];
}
//Normalize the Data Sets
R1.Normalize(new_x1 T1 new_x2 T2);
int* inliers = new int[nof];
int noi; // TO return number of inliers
int noo; // TO return number of outliers
//The Main Loop of the RANSAC
R1.MainLoop(new_x1 new_x2 nof 4 t H inliers noi noo);
//Separate the inliers and outliers
int j=0;
int k=0;
for(int i=0; i {
if
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
....... 18639 2008-04-16 08:43 RANSAC\ap.h
....... 98862 2008-05-06 10:18 RANSAC\ap.obj
....... 21627 2008-04-16 08:43 RANSAC\apvt.h
....... 7095 2008-04-16 08:43 RANSAC\bdsvd.h
....... 101699 2008-05-06 10:18 RANSAC\bdsvd.obj
....... 13521 2008-04-16 08:43 RANSAC\bidiagonal.h
....... 97457 2008-05-06 10:18 RANSAC\bidiagonal.obj
....... 3491 2008-04-16 08:43 RANSAC\blas.h
....... 71164 2008-05-06 10:18 RANSAC\blas.obj
....... 5988 2008-04-16 08:43 RANSAC\lq.h
....... 60693 2008-05-06 10:18 RANSAC\lq.obj
文件 5543 2008-05-08 13:44 RANSAC\main.cpp
....... 1488 2008-05-05 17:09 RANSAC\matinv.cpp
....... 6467 2008-04-16 08:43 RANSAC\qr.h
....... 72949 2008-05-06 10:18 RANSAC\qr.obj
文件 16596 2008-05-08 13:44 RANSAC\Ransac.cpp
文件 1977 2008-05-08 13:44 RANSAC\Ransac.h
文件 2173952 2008-05-08 13:13 RANSAC\RANSAC.ncb
....... 876 2008-05-05 11:54 RANSAC\RANSAC.sln
..A..H. 64512 2008-05-08 13:13 RANSAC\RANSAC.suo
....... 4518 2008-05-07 19:02 RANSAC\RANSAC.vcproj
文件 1413 2008-05-08 13:13 RANSAC\RANSAC.vcproj.NINTH.Administrator.user
....... 6688 2008-04-16 08:43 RANSAC\reflections.h
....... 37450 2008-05-06 10:18 RANSAC\reflections.obj
....... 5190 2008-04-16 08:43 RANSAC\rotations.h
....... 58793 2008-05-06 10:18 RANSAC\rotations.obj
....... 1358 2008-05-06 10:17 RANSAC\stdafx.h
....... 89045 2008-05-06 10:18 RANSAC\stdafx.obj
....... 155648 2008-05-06 10:18 RANSAC\SVD.dll
....... 5354 2008-04-16 08:43 RANSAC\svd.h
............此处省略7个文件信息
- 上一篇:ZLG240128F液晶驱动
- 下一篇:单片机C51自动循迹小车程序
相关资源
- 基于窗口的稀疏点匹配及三维重建
- OpenCV轮廓匹配
- 模板匹配多目标检测快速金字塔
- 一种新的模式匹配(模糊搜索)算法
- e语言-基于SunDay匹配算法改良的寻找字
- 论文研究-SIFT和改进的RANSAC算法在图像
- 归一化交叉相关图像匹配算法
- opencv实现的SIFT特征提取与匹配算法
- Opencv实现特征点提取和匹配
- 傅里叶特征描述子图像匹配
- IEEE Transactions Latex Template
- 车牌字符库素材可用于模拟车牌、模
- QT实现的类似QComplater可自定义匹配规
- halcon选择特定区域 模板匹配
- 相位相关法.rar
- 模板匹配为基础的目标检测算法
- 图像匹配-NCC算法实现
- halcon ncc 模板匹配
- Morvac点提取和相关系数匹配
- KMP串匹配的并行算法
- VS插件--括号匹配,在VS2010下用了,效
- 基于块匹配的一种有效的三步法运动
- opencv实现特征点的检测与匹配
- RegexMatchTracer_v2.1.5_FreeVersion
- 遥感影像上面状道路的准自动提取算
- harris+ncc+ransac
- Opencv 各种特征点提取和匹配
- IEEEtransaction模板(latex)
- 电阻匹配软件
- k-d树源代码
评论
共有 条评论