Home > other >  How to use CV: : cudacodec: : VideoReader
How to use CV: : cudacodec: : VideoReader

Time:05-16

I would like to use opencv to each frame of video processing, hope that through the gpu to accelerate, in order to reduce the transmission time of the CPU to the gpu I hope by the gpu decoding video directly, so I want to use a CV: : cudacodec: : VideoReader, I recompile WITH_CUDA WITH_OPENGL opencv library, but still can't normal use CV: : cudacodec: : VideoReader, hope to get your help, I want to run the following a demo

Int main (int arg c, char * * argv)

{

If (arg c!
=2)
return -1;

CV: : namedWindow (GPU, CV: : WINDOW_OPENGL);

CV: : cuda: : setGlDevice ();

CV: : cuda: : GpuMat d_frame;

CV: : Ptr D_reader=CV: : cudacodec: : createVideoReader (STD: : string (argv [1]));

While (true)

{

if (! D_reader - & gt; NextFrame (d_frame))

break;

CV: : imshow (" GPU, "d_frame);

If (CV: : waitKey (3) & gt; 0)

break;

}

return 0;

}
Note:
I tried to join the nvidia video decoding module to compile, results in the graphics for MX250 createVideoReader error of the machine, I guess because of the type of graphics card does not support hardware decoding, then again on another machine GTX1050ti were tested, the results createVideoReader successfully read by video, but d_reader - & gt; NextFrame (d_frame) is an error, I have to do,
  • Related