Hi all,
I want to test the boxfilter sample in the CUDA 3.1 SDK.
I need a help in the following:
1 - i tested the program with LenaRGB image and the results are OK. But, when i used my own image, the result of filtering appeared to has some extra rows in the bottom of the image (please, see the attached images). where is the problem?
2 - i want to test the function boxfilter (not boxfilterRGBA) with the following code:
width = 10;
height = 10;
float * h_img_float = NULL;
float * d_img_float = NULL;
float * d_temp_float = NULL;
float *d_result_float;
float *h_img_float = (float *)malloc(width * height * sizeof(float));
for(int y = 0; y < height; y++)
{
for(int x = 0; x < width; x++)
{
h_img_float[y * width + x] = y * 0.1;
printf(“%f\t”, h_img_float[y * width + x]);
}
printf(“\n”);
}
cutilSafeCall(cudaMalloc((void**)&d_img_float, (width * height * sizeof(float))));
cutilSafeCall(cudaMalloc((void**)&d_temp_float, (width * height * sizeof(float))));
cutilSafeCall(cudaMalloc((void **)&d_result_float, (width * height * sizeof(float))));
initTexture(width, height, h_img_float);
float *h_dest = (float *)malloc(width * height * sizeof(float));
double d = boxFilter(d_img_float, d_temp_float, d_result_float, width, height, filter_radius, iterations, nthreads);
cutilSafeCall(cudaMemcpy(h_dest, d_result_float, width * height * sizeof(float), cudaMemcpyDeviceToHost));
printf(“d = %f\n”, d);
for(int y = 0; y < height; y++)
{
for(int x = 0; x < width; x++)
{
float val = h_dest[y * width + x];
printf(“%f\t”, val);
}
printf(“\n”);
}
cleanup();
cutilSafeCall(cudaFree(d_result_float));
the printed values of the h_dest are very strange. also, where is the problem?
i am very sorry for the long message, but really, i need fst help.
thanks.
Ghada.