资源简介
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自动循迹小车程序
相关资源
- 文学研究助手(字符串的查找模式匹
- 字符串括号匹配(c实现)
- 基于MO实现CAD数据转换为Shape数据后的
- 基于NFC技术控制的电子钱包电路设计
- IBM System Storage DS3300按中小企业信息价
- 增程式电动车动力系统参数匹配及仿
- 基于ECE法规的缓速器制动力与制动力
- LL(1)文法的递归下降分析程序例题
- 手写数字识别-模板匹配法
- siftDemoV4.zip
- 基于相关系数的影像匹配
- 基于概率神经网络的图匹配算法研究
- 计算二分图最大匹配的Hopcroft-Karp算法
- LFM信号匹配滤波器能量检测、循环相
- 中文文本相似度匹配算法
- 立体匹配综合论文集
- 阿拉伯数字字符识别的简单识别
- 一种基于模板匹配的人民币编号识别
- lucene.net+盘古分词多条件全文检索并匹
- 角点检测与匹配
- opencv实现的sift算法源码,包含了图像
- 关于晶振与匹配电容的总结
- QCD热相变中的异常匹配
- 影像匹配、特征点提取、影像相关、
- Matalb实现停车场完整系统
- halcon中使用一种新思路来模板匹配的
- SIFT特征提取+匹配
- 电动汽车空调系统匹配设计
- 基于SIFT特征描述子的立体匹配算法
- 论文研究-基于SURF和快速近似最近邻搜
评论
共有 条评论