Reputation: 5978
OpenCV library, when compiled with GPU and OpenGL support, allows for displaying images with OpenGL. For example, video_reader.cpp
(located in gpu samples) uses OpenGL to render display graphics directly from cv::gpu::GpuMat
.
cv::gpu::GpuMat d_frame;
namedWindow("OpenGL", WINDOW_OPENGL);
cv::gpu::VideoReader_GPU d_reader(fname);
d_reader.dumpFormat(std::cout);
if (!d_reader.read(d_frame))
break;
cv::imshow("GPU", d_frame);
This is a very useful feature. However, it is not documented in the documentation on-line. For example, for namedWindow
the flag WINDOW_OPENGL
is not listed in the docs. Where can I find the documentation for OpenGL -related functionality of OpenCV?
Upvotes: 1
Views: 5024
Reputation: 377
Especially the second link gives you two easy options for rendering.
imshow
with a Texture2D
objectsetOpenGlDrawCallback()
(https://docs.opencv.org/4.x/df/d24/group__highgui__opengl.html#gaf80dcbc168a6ce40f6d1ad9d79a10bb8) which allows you to draw on top of a nameWindow("OpenGL Window", WINDOW_OPENGL)
using OpenGL.Upvotes: 2
Reputation: 844
The function
cv::imshow(const & string, cv::InputArray)
does not natively support gpu matrices, but supports GPU matrices by casting.
i.e. anything which supports a cv::Mat
on its input should also support cv::gpu::GpuMat
. I presume this means that when you call the function, it will automatically download the matrix to a cv::Mat
and go from there, i.e. your imshow
function call is not drawing directly gpu->gpu, but going gpu->cpu->gpu.
Upvotes: 0
Reputation: 767
The documentation is not very complete for 2.4.5. I don't think there is any more documentation than what you see on http://docs.opencv.org.
There are older documentation, such as http://opencv.willowgarage.com/documentation/cpp/ for 2.1, but I didn't find it having the documentation for the flag that you wanted.
Upvotes: 2