opencv3.4.1问题,求帮忙解决一下

// 视觉识别.cpp: 定义控制台应用程序的入口点。
 //
#include "stdafx.h"
#include <iostream>
#include <time.h>
#include <opencv2/opencv.hpp> 
#include <opencv2/xfeatures2d.hpp>
#include <Windows.h>
 //#include <Mmsystem.h>
using namespace cv;
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
Mat img1 = imread("D:\\OPencv\\match\\match\\cut.jpg");

Mat img2 = imread("D:\\OPencv\\match\\match\\pic.jpg");


cout << "图片一大小为:" << img1.rows*img1.cols << endl;
cout << "图片二大小为:" << img2.rows*img2.cols << endl;
cout << endl;

cvtColor(img1, img1, COLOR_BGR2GRAY);
cvtColor(img2, img2, COLOR_BGR2GRAY);


//resize(img1, img1, Size(100, img1.rows*100.0 / img1.cols));
//resize(img2, img2, Size(650, img2.rows*650.0 / img2.cols));
//cout << "图片一的大小为:"<< img1.rows*img1.cols << endl;
//cout << "图片二大小为:" << img2.rows*img2.cols << endl;
Ptr<Feature2D> f2d = xfeatures2d::SIFT::create();
vector <KeyPoint>  key_points1, key_points2;
f2d->detect(img1, key_points1);
f2d->detect(img2, key_points2);
cout << "检测关键点成功" << endl;
cout << "图一特征点的个数:" << key_points1.size() << endl;
cout << "图二特征点的个数:" << key_points2.size() << endl;
cout << endl;

Mat descriptors1, descriptors2;
//img1.copySize(descriptors1);
//img2.copySize(descriptors2);

f2d->compute(img1, key_points1, descriptors1);
f2d->compute(img2, key_points2, descriptors2);
cout << "特征点提取成功" << endl;
cout << "图一特征点为:" << descriptors1.size() << endl;
cout << "图二特征点为:" << descriptors2.size() << endl;
cout << endl;

BFMatcher matcher;
vector <DMatch> matches;
cout << matches.size() << endl;
cout<<descriptors1.depth()<<endl;
cout << descriptors2.depth() << endl;
matcher.match(descriptors1, descriptors2, matches,Mat());
cout << "特征点匹配成功" << endl;

cout << endl;

waitKey(0);

return 0;

}

程序附上,win10运行没有错误,但是在我电脑上win7运行有错。


如果特征描述矩阵一为空,程序可以正常运行,但是只要特征描述矩阵不为空,程序就报上面的错误,哪位大神可以帮忙解决一下,或者说一下是不是我环境配置的有问题啊?能给点解决方案吗????


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值