Color image in Sobel filter example from CUDA SDK how to apply sobel filter in the example to color

Hi everyone,

I’m trying to figure out the code in the Sobel filter example from CUDA SDK. But I have a problem when I try to apply the code to color image (lena.ppm).

[codebox]void loadDefaultImage( char* loc_exec) {

const char* image_filename = "<b>lena.ppm</b>";

}[/codebox]

I think the program has already provided a way to solve with color image, but when I run the program I got the result below

Hope to see your help,

Thank you very much :heart:

There is a comment at the beginning of the code which says:

//

// Cuda example code that implements the Sobel edge detection

// filter. This code works for 8-bit monochrome images.

//

So I guess you can safely assume it won’t work without modification for colour images.

part of the difficulty is the call to glTexImage2D doing
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, imWidth, imHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
gets rid of the white screen (and replaces it with a grayscale image). a start…