OpenCV 在窗口关闭时中止(核心转储)
OpenCV Aborted (core dumped) When the Window Is Closed
我尝试读取相机帧并使用cv::cuda::GpuMat
通过cv::namedWindow
显示它。
这是我C++代码:
cv::namedWindow("frame", cv::WINDOW_OPENGL);
cv::resizeWindow("frame", FRAME_WIDTH, FRAME_HEIGHT);
while (true) {
cv::Mat frame;
cv::cuda::GpuMat frame_gpu;
camera.read(frame);
frame_gpu.upload(frame);
cv::imshow("frame", frame_gpu);
//frame_gpu.download(frame);
if (cv::waitKey(1) == 27) {
break;
}
}
cv::destroyAllWindows();
如果我关闭窗口,我会收到此错误:
OpenCV Error: The function/feature is not implemented (You should explicitly call download method for cuda::GpuMat object) in getMat_, file /home/nvidia/opencv-3.2.0/modules/core/src/matrix.cpp, line 1276
terminate called after throwing an instance of 'cv::Exception'
what(): /home/nvidia/opencv-3.2.0/modules/core/src/matrix.cpp:1276: error: (-213) You should explicitly call download method for cuda::GpuMat object in function getMat_
Aborted (core dumped)
如果我键入Esc
键来结束逻辑,它不会引发任何异常。
为什么我会收到此错误,如何解决此问题?
我想错误是关于您尝试使用 imshow 显示GpuMat
图像。您需要先将其下载到其他Mat
,然后才能使用 imshow 显示它。 试试这个
cv::Mat host;
frame_gpu.upload(frame);
frame_gpu.download(host)
cv::imshow("frame", host);
相关文章:
- 如何找出GDB的SIGTRAP核心转储的根本原因
- C++映射分割错误(核心转储)
- 在c++中初始化矩阵时出现分段错误(核心转储)
- 在c++中键入向量中的所有值后,得到分段错误(核心转储)
- 浮点异常(核心转储)#694457
- 分段错误(核心转储)但无法弄清楚
- 链接到libkcapi时没有核心转储
- 分段错误(核心转储) - 使用 SavedModel 的 Tensorflow C++ API 进行推断
- 在基数排序中,我得到 munmap_chunk():无效指针和中止(核心转储).为什么?
- C++指针无法在函数外部传递值和分段错误(核心转储)错误
- 合并排序:分段错误核心转储
- C++:分段错误(核心转储)
- 从 pybind11 构建导入模块时出现"分段错误(核心转储)"
- 如何使用 lldb 在曼扎罗中调试 lz4 文件格式的核心转储?
- qt C++命令行代码中的分段错误(核心转储)
- 从文件中读取的数据,但发生核心转储错误
- googletest:测试基类具有纯虚拟方法的派生类时的核心转储
- C++ atof - 分段错误(核心转储)
- Linux C 只禁止我的程序使用核心转储
- 为什么我的代码包含错误分段错误(核心转储)?