opencv3.1,运行ORB算法是出现未为 opencv_features2d310d.dll 加载任何符号

Class_guy 2017-08-22 08:52:47
我在opencv3.1上运行ORB算法时一直提示未为 opencv_features2d310d.dll 加载任何符号,而且提示错误出在VideoCapture capture;这一行:0x00007FFD97AB3C58 处(位于 ORB特征提取.exe 中)有未经处理的异常: Microsoft C++ 异常: cv::Exception,位于内存位置 0x0000007BCDEFE4C0 处。

我检查了老半天都没发现错误,求各位高手帮帮忙解答一下。

#include <opencv2/opencv.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/xfeatures2d/nonfree.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/flann/flann.hpp>
#include <iostream>

using namespace cv;
using namespace std;
using namespace cv::xfeatures2d;

int main()
{
//载入原图,显示并转化为灰度图
Mat srcImage = imread("1.jpg");
Mat srcImage_gray;
imshow("原图", srcImage);
cvtColor(srcImage, srcImage_gray, COLOR_RGB2GRAY);

//参数定义
Ptr<ORB> detector = ORB::create();
vector<KeyPoint> keypoints_1;
Mat descriptor_1;

//调用detect函数检测出特征关键点
detector->detectAndCompute(srcImage_gray, noArray(), keypoints_1, descriptor_1, false);;

//基于FLANN的描述符对象匹配
FlannBasedMatcher matcher;
vector<Mat> trainCollection(2, descriptor_1);
matcher.add(trainCollection);
matcher.train();

//初始化视频采集对象
VideoCapture capture;
capture.open(0);
capture.set(CV_CAP_PROP_FRAME_WIDTH, 360);//设置视频的宽度
capture.set(CV_CAP_PROP_FRAME_HEIGHT, 900);//设置视频的高度
unsigned int framecount = 0;

//轮询,知道按下ESC键退出循环
while (char(waitKey(1))!='q')
{
int64 time0 = getTickCount();
Mat testImage, testImage_gray;
capture >> testImage;
if (testImage.empty())
continue;

cvtColor(testImage, testImage_gray, COLOR_RGB2GRAY);

//检测ROB关键点并提前测试图像中的描述符
vector<KeyPoint> keypoints_2;
Mat descriptor_2;
detector->detectAndCompute(testImage_gray, noArray(), keypoints_2, descriptor_2, false);

//匹配和测试描述符,获取两个最邻近的描述符
/*Mat matchIndex(descriptor_2.rows, 2, CV_32SC1);
Mat matchDistance(descriptor_2.rows, 2, CV_32SC1);
flannIndex.knnSearch(descriptor_2, matchIndex, matchDistance, 2, flann::SearchParams());//调用K邻近算法
*/
vector<vector<DMatch>> matches;
matcher.knnMatch(descriptor_2, matches, 2);

//根据劳氏算法选出优秀的匹配
vector<DMatch> goodMatches;
for (unsigned int i = 0; i < matches.size(); i++)
{
if (matches[i][0].distance<0.6*matches[i][1].distance)
{
goodMatches.push_back(matches[i][0]);
}
}

//绘制并显示匹配窗口
Mat resultImage;
drawMatches(srcImage, keypoints_1, testImage, keypoints_1, goodMatches, resultImage);
imshow("匹配窗口图", resultImage);

cout << "当前帧率为:" << getTickFrequency() / (getTickCount() - time0) << endl;

}
return 0;
}
...全文
1905 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Clover97 2018-08-29
  • 打赏
  • 举报
回复
lz, 请问您是怎么解决的呀?
Class_guy 2017-12-21
  • 打赏
  • 举报
回复
已经解决了。
mozun2020 2017-12-20
  • 打赏
  • 举报
回复
想知道楼主这个问题解决了没

4,445

社区成员

发帖
与我相关
我的任务
社区描述
图形图像/机器视觉
社区管理员
  • 机器视觉
  • 迪菲赫尔曼
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧