Hello,
I was wondering if someone could point me out how to use the nppiErode_8u_C1R function from the NPP library. This is what I have tried with no success:
// Used to store the rasters in the device
Npp8u* d_rasterGrayscale;
Npp8u* d_erotionResultGrayscale;
cudaMalloc((void**) &d_rasterGrayscale, sizeof(uint8) * width * height);
cudaMalloc((void**) &d_erotionResultGrayscale, sizeof(uint8) * width * height);
// Apply erotion from the NPP library
cudaMemcpy(d_rasterGrayscale, rasterGrayscale, sizeof(uint8) * width * height, cudaMemcpyHostToDevice);
uint8 h_mask[] = {1,1,1,1,1,1,1,1,1};
uint8* d_mask;
cudaMalloc((void**) &d_mask, sizeof(uint8) * 9);
cudaMemcpy(d_mask, h_mask, 9, cudaMemcpyHostToDevice);
NppiSize roi; // Apply erotion to the whole image
roi.width = width;
roi.height = height;
NppiSize maskSize;
maskSize.width = 3;
maskSize.height = 3;
NppiPoint anchor;
anchor.x = 1;
anchor.y = 1;
NppStatus erotionStatus;
erotionStatus = nppiErode_8u_C1R(d_rasterGrayscale, width, d_erotionResultGrayscale, width, roi, d_mask, maskSize, anchor);
cudaMemcpy(erotionResultGrayscale, d_erotionResultGrayscale, sizeof(uint8) * width * height, cudaMemcpyDeviceToHost);
// Free the memory on the device
cudaFree(d_rasterGrayscale);
cudaFree(d_erotionResultGrayscale);
cudaFree(d_mask);
The erotionStatus reports: NPP_TEXTURE_BIND_ERROR
Any advices would be greatly appreciated.
Thanks,
Cristobal