Hi fellas,
I started work with Nvidia Performance Primitives. To be familiar with it, i looked at the sample codes like boxFilter and freeImageInterop. After that, i tried to use an image loaded to memory using OpenCV in NPP. However i can not manage it successfully. I searched and read a lot of forum thread but i can not find any solution to my problem.
I made the sample run flawlessly but the result is not correct. Let’s look at boxFilter sample;
img is my opencv image format which is IplImage* and i want to copy it into pSrcImageCUDA which is in Npp8u* format. They can be seen as same format, however there is a mistake about conversion. I use Lena.pgm which is come with the NPP and it is a 512x512 sized grayscale image.
Npp8u * pSrcImageCUDA;
int nSrcPitchCUDA;
pSrcImageCUDA = nppiMalloc_8u_C1(img->width, img->height, &nSrcPitchCUDA);
cudaMemcpy2D(pSrcImageCUDA, nSrcPitchCUDA, img->imageData, 512, img->width, img->height, cudaMemcpyHostToDevice);
And the part where box filter operation takes place. oDeviceSrc is a npp::ImageCPU_8u_C1 object and is created using oHostSrc which reads and keeps the image, i changed oDeviceSrc.data() with pSrcImageCUDA. oDeviceSrc.data() is in Npp8u* format.
eStatusNPP = nppiFilterBox_8u_C1R(pSrcImageCUDA, oDeviceSrc.pitch(), oDeviceDst.data(), oDeviceDst.pitch(), oSizeROI, oMaskSize, oAnchor);
When i looked at the result, i saw that the image’s specific part is box filtered and image is seen as zoomed.
It is a simple try. Where is my mistake? If anybody help me, i really appreciate:)