JavaCv/OpenCv 错误:这是什么意思?
我将 JavaCv 与 OpenCv 2.3 来自 Java(在 Windows 上)。偶尔会出现问题,OpenCv 会抛出错误,例如:
OpenCV 错误:未知函数中的错误参数(无法识别或不支持的数组类型),文件 ..\..\..\..\ocv\opencv\modules\core\src\array.cpp,第 995 行
使用以下 Java 堆栈跟踪:
at com.googlecode.javacv.cpp.opencv_core.cvReleaseImage(Native Method)
at com.googlecode.javacv.cpp.opencv_core$IplImage$ReleaseDeallocator.deallocate(opencv_core.java:492)
at com.googlecode.javacpp.Pointer$DeallocatorReference.clear(Pointer.java:127)
at com.googlecode.javacpp.Pointer.deallocator(Pointer.java:171)
at com.googlecode.javacpp.Pointer.init(Pointer.java:61)
at com.googlecode.javacv.cpp.opencv_core$CvSize.allocate(Native Method)
at com.googlecode.javacv.cpp.opencv_core$CvSize.<init>(opencv_core.java:2152)
at com.googlecode.javacv.cpp.opencv_core.cvSize(opencv_core.java:2170)
即当我尝试释放图像时会发生这种情况。由于我对 C++ 和 OpenCv 内部知识了解不多,所以我想我应该在这里问。
错误信息是什么意思?释放 IplImage 时是否有什么可能导致发生这种情况?
元:之前的问题还询问了有关捕获/跳过 Microsoft Visual C++ 运行时错误对话框的问题。但是,我意识到我在问两个完全不同的问题,并将该部分迁移到 这个问题。
I'm using JavaCv with OpenCv 2.3 from Java (on Windows). Occasionally something goes wrong, and OpenCv throws an error, something like:
OpenCV Error: Bad argument (unrecognized or unsupported array type) in unknown function, file ..\..\..\..\ocv\opencv\modules\core\src\array.cpp, line 995
With the following Java stacktrace:
at com.googlecode.javacv.cpp.opencv_core.cvReleaseImage(Native Method)
at com.googlecode.javacv.cpp.opencv_core$IplImage$ReleaseDeallocator.deallocate(opencv_core.java:492)
at com.googlecode.javacpp.Pointer$DeallocatorReference.clear(Pointer.java:127)
at com.googlecode.javacpp.Pointer.deallocator(Pointer.java:171)
at com.googlecode.javacpp.Pointer.init(Pointer.java:61)
at com.googlecode.javacv.cpp.opencv_core$CvSize.allocate(Native Method)
at com.googlecode.javacv.cpp.opencv_core$CvSize.<init>(opencv_core.java:2152)
at com.googlecode.javacv.cpp.opencv_core.cvSize(opencv_core.java:2170)
I.e. it occurs when I try to deallocate an image. Since my knowledge of C++ and OpenCv internals is, well, not much, I thought I'd ask here.
What does the error message mean? Is there anything that could cause then to happen while releasing an IplImage?
Meta: the question previously also asked about catching/skipping a Microsoft Visual C++ Runtime Error dialogue. However, I realised I was asking two completely different questions, and migrated that part to this question.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用
IplImage.create()
分配IplImage
,则不应对其手动调用cvReleaseImage()
。 <- 这很可能是错误的原因。要么调用 IplImage.release() 要么让垃圾收集器在将来的某个时候为您释放它......If you allocate your
IplImage
usingIplImage.create()
, you should not callcvReleaseImage()
manually on it. <- This is most likely the cause of the error. Either callIplImage.release()
or let the garbage collector deallocate it for you, at some point in the future...