Creating an image from a raw data file

Hi everyone,

I have a file which i want to display the images within it using CUDA.

The header file includes the image width and image depth (height). I have the image frame size (stored as a 2 dimensional array of the image data). The data was saved as processed images in log scale (256 gray levels with one byte per pixel)

I was wondering what steps I should take to display these images with CUDA. I was thinking of using “texture” to display it but I’m not sure if this is the proper way to do it. I’ve checked out other ways with OpenGL but it seems a lot more than what I can handle.



CUDA cannot display things. It is merely a means to run many parallel computations. Due to the fact that it computes on the GPU, and its data is in GPU memory, it is common to then share that data with an OpenGL context for rendering when relevant. However, if you’re just wanting to display an image as is from a file, there is no need for CUDA and you should actually use OpenGL or even something simple like SDL (with SDL_image).

edit: maybe i didn’t understand. are you wanting to ‘unprocess’ the data in some way? In that case using CUDA may be a good idea if you have no shader experience.

If you want to visualize results from CUDA, you can use the DirectX or OpenGL interoperability features. The basic idea is that CUDA can process data in a buffer that OpenGL can see, which you can then use to make a picture. I have never used this feature personally (but many people in the forum have). I would go search for “OpenGL” in the programming guide and also look at any SDK examples with the string “GL” in the name.

Why do you want to display the images with CUDA? Why not just parse the files and draw an image using normal programming methods? Or do you need to do computation on them as well (like seibert wrote)?