如何找出导致“cv::Exception at memory location"的原因? [英] how to find out what is causing "cv::Exception at memory location"?

查看:44
本文介绍了如何找出导致“cv::Exception at memory location"的原因?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前遇到一些奇怪的异常,这很可能是因为我在与 opencv 交互时做错了一些事情:

I'm currently suffering from some strange exceptions that are most probably due to me doing something incorrectly while interacting with opencv:

xxx.exe 中 0x7580b9bc 处的第一次机会异常:Microsoft C++ 异常:cv::Exception at memory location 0x00c1c624..

我已经在 Debug -> 中启用了 Thrown 字段;Exceptions 菜单,但是我真的不知道在我的代码中抛出异常的位置.

I've already enabled the Thrown field in the Debug -> Exceptions menu, however I really can't figure out where in my code the exception is thrown.

我该如何调试?

编辑堆栈帧读起来像这样(我的应用程序甚至不会出现在列表中!):

EDIT the stack frame reads like this (my app won't even show up in the list!):

  • KernelBase.dll!7580b8bc()
  • [下面的框架可能不正确或丢失]
  • KernelBase.dll!7580b8bc()
  • opencv_core242d.dll!54eb60cc()

推荐答案

您可以将整个 main 包装在 try catch 块中,该块会打印出异常详细信息.如果开放的 CV API 可以抛出异常,您将需要考虑将它们作为设计的一部分进行处理:

You could wrap your entire main in a try catch block which prints out the exception details. If the open CV API can throw exceptions, you will need to think about handling them anyway as part of your design:

try
{
  // ... Contents of your main
}
catch ( cv::Exception & e )
{
 cerr << e.msg << endl; // output exception message
}

这篇关于如何找出导致“cv::Exception at memory location"的原因?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆