Ask Your Question

USB video capture to cuda

asked 2013-07-03 16:50:19 -0500

JobyBett gravatar image

First off sorry I'm new to Windows and CUDA programming, well all of CV really.

I have a Diamond GC1000 USB video capture device, I want to be able to feed the HD video stream from the device into my GPU so that I can real time process the frames, but I have no idea where to start.

My basic stumbling block is I don't understand how I interface my CUDA code to the USB drivers, I have my CUDA code that I can say perform edge detection on a static PNG, what I need to do is replace that PNG with the stream frames from the GC1000.

Any guidance would be appreciated!



edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-07-04 01:05:01 -0500

Prasanna gravatar image

updated 2013-07-04 01:08:43 -0500

First off there is no need to be sorry for being new to anything. You have the enthusiasm. That counts.

Think of your problem as stages of a pipeline and analyze what you have and what you don't. You will get it.

And if you need help from OpenCV, it has its own gpu modules to help you get started. Have a look at this. You can use this for edge detection. And have a look at this module for getting the frames from a video/device. There is also a GPU based VideoReader if you are reading from a video file.

Play around for a while, you will surely get what you are looking for. Don't forget to have a peek at the gpu examples of OpenCV. They help a lot.

Hope this helps.


Prasanna S

edit flag offensive delete link more


Thanks you so much for your response, I started with an apology as I have been trying to get some help on the Nvidia CUDA dev forum for months and no one responded, should have come to the open community first.

I reversed the course I was taking, I had installed MS VS and the Nvidia dev kit, created a CUDA project as a base and tried to get OpenCV integrated that way. So I binned that and have followed the tutorial you linked, and now have a working real time edge detection from my cam :)

As long as I can offload all the video and frame processing to the GPU I guess I don't need actual CUDA code? I intend to process something like 10 frames a second of 1080i video, detecting edges/boxes and from there comparing with templates to make decisions as to what is on ...(more)

JobyBett gravatar imageJobyBett ( 2013-07-09 11:19:44 -0500 )edit

I dont think I understood your requirements completely. But, As far as I understood, you wont touch CUDA code as long as your are using OpenCV for your application as it is all wrapped up into the gpu module. (its kinda sad as the opportunity to learn CUDA goes down :( ).

If you want to use CUDA code, you need to get to the base of the streamer (for grabbing video frames) and convert it into the format which your code can accept. Looks tough (I havent tried it though). Otherwise, OpenCV has all the major things you will need. (Edge detection -> Canny, Template matching -> gpu::matchTemplate)

You can process at a greater FPS on videos, but not on cam as you need to upload and download data everytime (to the GPU) which results in lower fps.

Prasanna gravatar imagePrasanna ( 2013-07-10 04:08:10 -0500 )edit

Question Tools

1 follower


Asked: 2013-07-03 16:50:19 -0500

Seen: 2,745 times

Last updated: Jul 04 '13