c++ - OpenCV Aborted (core dumped) When the Window Is Closed -
i try read camera frame , show through cv::namedwindow
using cv::cuda::gpumat
.
here c++ code:
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();
if close window got error:
opencv error: function/feature not implemented (you should explicitly call download method cuda::gpumat object) in getmat_, file /home/nvidia/opencv-3.2.0/modules/core/src/matrix.cpp, line 1276 terminate called after throwing instance of 'cv::exception' what(): /home/nvidia/opencv-3.2.0/modules/core/src/matrix.cpp:1276: error: (-213) should explicitly call download method cuda::gpumat object in function getmat_ aborted (core dumped)
if type esc
key end logic, not raise exception.
why error , how can solve this?
i guess error trying display gpumat
image using imshow. need download mat
before can display using imshow. try this
cv::mat host; frame_gpu.upload(frame); frame_gpu.download(host) cv::imshow("frame", host);
Comments
Post a Comment