opencv vs2017调试错误


请问这是什么错误啊?如何更正?
...全文
223 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
Mr。Lili 2018-07-27
  • 打赏
  • 举报
回复
opencv没有这个啊#include <opencv2/xfeatures2d.hpp>。 我又下载的 opencv-3.4.1-vc14_vc15 也没有。
  • 打赏
  • 举报
回复
引用 1 楼 xyqdz 的回复:
把代码贴上来看下。

#include <opencv2/opencv.hpp>
#include <opencv2/xfeatures2d.hpp>
#include <iostream>

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

int main()
{
system("color 5F");

Mat trainImage = imread("D:\\O\\cst\\07.jpg");
imshow("原始图", trainImage);

Mat trainImage_gray;
cvtColor(trainImage, trainImage_gray, CV_BGR2GRAY);

vector<KeyPoint> train_keyPoint;
Mat trainDescription;
SiftFeatureDetector featureDetetor;
featureDetetor.detect(trainImage_gray, train_keyPoint);
SiftDescriptorExtractor featureExtractor;
featureDetetor.compute(trainImage_gray, train_keyPoint, trainDescription);

BFMatcher matcher;
vector<Mat> train_desc_collectin(1, trainDescription);
matcher.add(train_desc_collectin);
matcher.train();

VideoCapture cap(0);
unsigned int frameCount = 0;

while (char(waitKey(1)) != 'q')
{
double time0 = getTickCount();
Mat captureImage, captureImage_gray;
cap >> captureImage;
if (captureImage.empty())
continue;

cvtColor(captureImage, captureImage_gray, CV_BGR2GRAY);

vector<KeyPoint> test_keyPoint;
Mat testDescriptor;
featureDetetor.detect(captureImage_gray, test_keyPoint);
featureExtractor.compute(captureImage_gray, test_keyPoint, testDescriptor);

vector<vector<DMatch>> matches;
matcher.knnMatch(testDescriptor, matches, 2);

vector<DMatch> goodMatches;
for (double k = 0; k < matches.size(); k++)
{
if (matches[k][0].distance < 0.6 * matches[k][1].distance)
goodMatches.push_back(matches[k][0]);
}

Mat dstImage;
drawMatches(captureImage, test_keyPoint, trainImage, train_keyPoint, goodMatches, dstImage);
imshow("匹配窗口", dstImage);

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

return 0;
}
Mr。Lili 2018-07-27
  • 打赏
  • 举报
回复
引用 3 楼 qq_41233366 的回复:
[quote=引用 1 楼 xyqdz 的回复:]
把代码贴上来看下。

最后两张图就是所有的代码[/quote]
你把代码粘贴上来我调试看下,我这正好有opencv的环境。总不能让我把你的代码打出来吧。
  • 打赏
  • 举报
回复
引用 6 楼 xyqdz 的回复:
opencv没有这个啊#include <opencv2/xfeatures2d.hpp>。 我又下载的 opencv-3.4.1-vc14_vc15 也没有。

你需要在配置一下这个包opencv-con,百度看看……
  • 打赏
  • 举报
回复
引用 1 楼 xyqdz 的回复:
把代码贴上来看下。

最后两张图就是所有的代码
赵4老师 2018-07-26
  • 打赏
  • 举报
回复
崩溃的时候在弹出的对话框按相应按钮进入调试,按Alt+7键查看Call Stack即“调用堆栈”里面从上到下列出的对应从里层到外层的函数调用历史。双击某一行可将光标定位到此次调用的源代码或汇编指令处,看不懂时双击下一行,直到能看懂为止
Mr。Lili 2018-07-26
  • 打赏
  • 举报
回复
把代码贴上来看下。

24,855

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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