cv::rectangle on GpuMat

asked 2017-03-22 10:29:38 -0500

ThorbjornSomod gravatar image


I am plain and simple wondering if there is any way to draw a ROI cv::rectangle on a cv::cuda::GpuMat? I have written a program for object detection on a live video feed, but drawing the rectangles using the CPU is slowing down the visual performance a lot. If there are any libraries out there or any nifty tricks that would let me do this on a GpuMat i would be very happy if you had any information for me!

edit retag flag offensive close merge delete


It is a little bit strange for me that drawing rectangles on CPU degrades a lot the performance. The data transfer between the GPU memory to the host memory surely costs. Which algorithm do you use for the object detection?

The best option for me would be to convert the GpuMat to an OpenGL texture somehow and use directly OpenGL for the display.

Eduardo gravatar imageEduardo ( 2017-03-22 12:47:39 -0500 )edit

True, the data transfer is the real killer, but since it seems that support has been dropped for the cuda:video_reader and cuda:video_writer functions I am stuck with that. The reason drawing the ROIs seems to take a long time for me is that each frame is in 1080p and contains up to 30 objects. I am using a Cascade Classifier based on LBP features that I trained myself 😉 I have also considered rendering using OpenGL, but the data conversions would be even worse then 🙁

ThorbjornSomod gravatar imageThorbjornSomod ( 2017-03-22 18:09:02 -0500 )edit