博主的环境是opencv3.2+vs2015
因为需要使用findHomography函数来实现RANSAC算法,对特征点进行筛选,所以博主写了一段代码实现这个程序
while (getline(load_stream, temp)&&temp != " ")
{
number_of_feature_couple = 0;
number_of_ransac_couple = 0;
number_of_fram++;
double x1, x2, y1, y2;
istringstream(temp) >> x1 >> x2 >> y1 >> y2;
if (x2 == 100000)
{
number_of_feature_couple = x1;
}
for (int i = 0; i < number_of_feature_couple; i++)//读入经过SIFT处理的特征点对
{
getline(load_stream, temp);
istringstream(temp) >> x1 >> x2 >> y1 >> y2;
Point temp_a(x1, y1);
Point temp_b(x2, y2);
pre.push_back(temp_a);
next.push_back(temp_b);
}
Mat f1(number_of_feature_couple, 2, CV_32F);
Mat f2(number_of_feature_couple, 2, CV_32F);
for (int i = 0; i < number_of_feature_couple; i++)
{
f1.at<float>(