[英]OpenCV+Visual Studio 2008 - Program runs fine in debug but access violation in regular execution
I'm working on a computer vision program at the moment with OpenCV in C++. 目前,我正在使用C ++中的OpenCV开发计算机视觉程序。 It seems to work 100% fine with a live feed from a webcam but when I tried to feed in a stream from an avi file it started crashing with an "Access Violation" error.
使用网络摄像头的实时供稿似乎可以100%正常工作,但是当我尝试从avi文件供稿时,它开始崩溃并出现“访问冲突”错误。 I can't see why this would be the case because the only difference between the two is the initial frame-grabbing- the image processing is the same afterwards.
我看不到为什么会这样,因为两者之间的唯一区别是初始抓帧-之后的图像处理是相同的。
I'm developing in VS2008. 我正在VS2008中进行开发。 The curious thing is that when I place a breakpoint in my main() and debug (F5) the program runs fine.
奇怪的是,当我在main()中放置一个断点并调试(F5)时,程序运行正常。 However, when I Start Without Debugging (Ctrl+F5) I get the error.
但是,当我不调试而开始(Ctrl + F5)时,出现错误。
Has anybody encountered a similar problem or would anyone know why my program would appear to work fine when debugging but not in normal execution? 有没有人遇到过类似的问题,或者有人知道为什么我的程序在调试时似乎可以正常运行,但不能正常运行吗?
Nothing specific about OpenCV, but the fact that it behaves differently with a different source stream, and in or out of the debugger, makes me think it is a timing issue. 关于OpenCV并没有什么特别的,但是它在不同的源流中以及在调试器中或调试器之外的行为不同,这一事实使我认为这是一个定时问题。 You could try attachng the debugger after the crash happens maybe.
您可以在崩溃发生后尝试附加调试器。
I would suspect uninitialized variables. 我会怀疑未初始化的变量。 Many debuggers initialize all variables, including those that are not.
许多调试器会初始化所有变量,包括未初始化的变量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.