1
votes

I am trying to implement an algorithm for a system which the camera get 1000fps, and I need to get the value of each pixel in all images and do the different calculation on the evolution of pixel[i][j] in N number of images, for all the pixels in the images. I have the (unsigned char *ptr) I want to transfer them to the GPU and start implementing the algorithm.but I am not sure what would be the best option for realtime processing. my system: CPU Intel Xeon x5660 2.8Ghz(2 processors) GPU NVIDIA Quadro 5000

I got the following questions:

  1. I do I need to add any Image Processing library addition to CUDA? if yes what do you suggest?

  2. can I create a matrix for pixel[i,j] containing values for images [1:n] for each pixel in the image size? for example for 1000 images with 200x200 size I will end up with 40000 matrix each containing 1000 values for one pixel? Does CUDA gives me some options like OpenCV to have a Matrices? or Vector?

3
Is the operation going to be "streaming oriented" where you will constantly remove the oldest of the 1000 frames and add the newest? Or is it more of a batch operation where you process 1000 frames, then toss them out and do 1000 new frames?Roger Dahl
I think it should be "Streaming Oriented".user261002
Since you mentioned OpenCV, you might want to add it as a tag in your question.karlphillip

3 Answers

2
votes

It sounds like you will have 40000 independent calculations, where each calculation works only within one (temporal) pixel. If so, this should be a good task for the GPU. Your 352 core Fermi GPU should be able to beat your 12 hyperthreaded Xeon cores.

Is the algorithm you plan to run a common operation? It sounds like it might not be, in which case you will likely have to write your own kernels.

Yes, you can have arrays of elements of any type in CUDA.

Having this being a "streaming oriented" approach is good for a GPU implementation in that it maximizes number of calculations as compared to transfers over the PCIe bus. It it might also introduce difficulties in that, if you want to process the 1000 values for a given pixel in a specific order (oldest to newest, for instance), you will probably want to avoid continuously shifting all the frames in memory (to make room for the newest frame). It will slightly complicate your addressing of the pixel values, but the best approach, to avoid shifting the frames, may be to overwrite the oldest frame with the newest frame each time a new frame is added. That way, you end up with a "stack of frames" that is fairly well ordered but has a discontinuity between old and new frames somewhere within it.

4
votes

1 - Do I need to add any Image Processing library addition to CUDA?

Apples and oranges. Each has a different purpose. An image processing library like OpenCV offers a lot more than simple accelerated matrix computations. Maybe you don't need OpenCV to do the processing in this project as you seem to rather use CUDA directly. But you could still have OpenCV around to make it easier to load and write different image formats from the disk.

2 - Does CUDA gives me some options like OpenCV to have a Matrices?

Absolutely. Some time ago I wrote a simple (educational) application that used OpenCV to load an image from the disk and use CUDA to convert it to its grayscale version. The project is named cuda-grayscale. I haven't tested it with CUDA 4.x but the code shows how to do the basic when combining OpenCV and CUDA.

1
votes

I do I need to add any Image Processing library addition to CUDA ??? if yes what do you suggest?

Disclosure: My company develop & market CUVILib

There are very few options when it comes to GPU Accelerated Imaging libraries which also offer general-purpose functionality. CUVILib is one of those options which offers the following, very suited for your specific needs:

  1. CuviImage object which holds your image data and image as a 2D matrix
  2. You can write your own GPU function and use CuviImage as a 2D GPU matrix.
  3. CUVILib already provides a rich set of Imaging functionality like Color Operations, Image Statistics, Feature detection, Motion estimation, FFT, Image Transforms etc so chances are that you will find your desired functionality.

As for the question of whether GPUs are suited for your application: Yes! Imaging is one of those domains which are ideal for parallel computation.

Links: