opencv 初学者常见问题

① imshow 显示图像为灰色图片或者视频显示不出来

【解决方案】

一定要加 waitKey()


② 环境变量配置之后需要重启电脑,VS中项目:包含目录、库目录(lib库) 配置;

库目录的配置x86 : 对应32位编译器;x64 : 对应64位编译器  【无关操作系统的位数】

Debug : *d.lib; release :  *.lib 【配置错误的话可能有<1>未经处理的异常】

项目的属性配置好之后还是需要重启电脑【我也不知为什么】


③opencv3.1.0 一直没有配置成功,也不明白是为什么,新手还是不要用了


④ imread mat is empty

【问题可能出现的来由】 添加图片不能直接在vs项目下,要添加到项目的当前目录下

==>一定要保证路径是对的



⑤ First-chance exception at * in *.exe Microsoft C++ exception

First-chance exception at 0x757CC42D in *.exe: Microsoft C++ exception: cv::Exception at memory location 0x0034F47C.

【问题描述】 

https://blogs.msdn.microsoft.com/davidklinems/2005/07/12/what-is-a-first-chance-exception/

What is a first chance exception?
When an application is being debugged, the debugger gets notified whenever an exception is encountered  At this point, the application is suspended and the debugger decides how to handle the exception. The first pass through this mechanism is called a “first chance” exception. Depending on the debugger’s configuration, it will either resume the application and pass the exception on or it will leave the application suspended and enter debug mode. If the application handles the exception, it continues to run normally.

In Visual Studio, you may see a message in the output window that looks like this:

A first chance exception of type ‘System.ApplicationException’ occurred in myapp.exe

In Visual Studio 2005 Beta2, you will see this message anytime a first chance exception is encountered in your application’s code.  If you are using Visual Studio .NET 2003, this message is shown if you have configured the debugger to stop when the specific exception type is thrown.

If the application does not handle the exception, the debugger is re-notified. This is known as a “second chance” exception. The debugger again suspends the application and determines how to handle this exception. Typically, debuggers are configured to stop on second chance (unhandled) exceptions and debug mode is entered, allowing you to debug. 

Does a first chance exception mean there is a problem in my code?
First chance exception messages most often do not mean there is a problem in the code. For applications / components which handle exceptions gracefully, first chance exception messages let the developer know that an exceptional situation was encountered and was handled.

For code without exception handling, the debugger will receive a second chance exception notification and will stop with a unhandled exception. 

【解决方案 -转-】

First-chance exception表明程序运行出现了access violation异常,但被你或者你使用的某个模块中的异常处理程序捕捉到了。调试器用这种办法来通知你出现了一个异常。在调试状态下,打开debug菜单下的exception对话框,把access violation异常的action改成stop always,这时再出现异常,调试器就会弹出一个对话框报告这个异常,并在异常发生处停下来,而不仅仅是在output窗口中报告first-chance exception,这有助于你定位异常位置。

解释二:

 在调试器中运行程序时,如果程序产生异常,调试器会首先获得通知(即First-chance exception),而后此异常由产生它的程序负责捕获。如果程序没有捕获此异常,那么调试器会再次被通知(即Second-chance exception,Last-chance exception),并结束程序。
通常见到的“First-chance exception”一般是“0xC0000005: Access Violation”,“0xC00000FD: Stack Overflow”等,这些都说明程序中有缺陷,需要修正。
但是也有一些属于正常的情况,例如“First-chance exception in xxx.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception”。Windows 操作系统中广泛使用了结构化异常(SEH)来处理特殊情况,许多和底层打交道的API都靠SEH来处理可能发生的意外。并且,这些API中都有捕获SEH的代码,产生的异常不会对程序造成影响。但是由于上面提到的“First-chance exception,Second-chance exception”机制,VC仍然会有输出,但是我们完全可以忽略。
如果你实在不喜欢这些输出信息,那你就必须禁用对特定异常的“First-chance exception”捕获
    其方法如下:
-Start   debugging   your   program. 
-Go   to   Debug   |   Exceptions... 
-Choose   "e06d7363   Microsoft   C++   Exception "   from   the   bottom   of   the   "Exceptions "   list. 
-Choose   "Stop   always " 
-Click   "Change " 
-Click   "OK " 


Now   your   debugger   will   stop   when   it   encounters   a   first-chance   C++   exception,   and   you   can   examine   the   call   stack,   etc,   and   investigate.   (You   may   need   to   restart   the   debugging   session,   if   the   exception   has   taken   place   before   you   get   this   setting   changed.)
 
在number中选择:E06D7363 Name:Microsoft   C++   Exception ,在Action中选择“Stop alwaws”就会停到此处,选择“Stop if not handled”就不会停到此处了。


⑥  r6010 - abort() has been called

【原因】1>内存 2>非法指针 3>中文

【解决方法】

第一:检查申请的空间没有释放
第二:检查堆栈空间是否已经被全部分配满,建议每次内存分配尽量不要太大,并且记得释放
第三:指针指向了不可预期的内存位置 

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值