JavaCv/OpenCv 错误:这是什么意思?

发布于 2024-11-28 03:45:11 字数 1361 浏览 0 评论 0原文

我将 JavaCvOpenCv 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怀中猫帐中妖 2024-12-05 03:45:11

如果您使用 IplImage.create() 分配 IplImage,则不应对其手动调用 cvReleaseImage()。 <- 这很可能是错误的原因。要么调用 IplImage.release() 要么让垃圾收集器在将来的某个时候为您释放它......

If you allocate your IplImage using IplImage.create(), you should not call cvReleaseImage() manually on it. <- This is most likely the cause of the error. Either call IplImage.release() or let the garbage collector deallocate it for you, at some point in the future...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文