CUDA 4.1 NPP Graphcut inconsistent output


I’m using the nppiGraphcut_32s8u NPP Graphcut function in my project. It worked perfectly with CUDA 4.0, but when I upgraded to CUDA 4.1 (and adapted the function call) the output was different. Unlike CUDA 4.0 the binary output image is encoded as 0/1, while the NPP documentation states that it is encoded as 0/255.

The CUDA 4.1 SDK imageSegmentationNPP sample shows how to scale the result to 0/255:

nppiMulC_8u_C1IRSfs(255,, oDeviceDst.pitch(), size, 0);

NVIDIA, could you please update the NPP documentation and make a remark about this?

Hi HvLint,

thanks for your post. You are right, the output did change between versions. The correct specification for the output is acutally 0 and >0. We will correct the documentation for the upcoming CUDA 5 release accordingly. The suggested way to map the output of the Graphcut primitive to a 0/255 range is to use the compare primitve:

ImageNPP_8u_C1 oDeviceAlpha(width, height);

nppiCompareC_8u_C1R(, oGraphcutResult.pitch(), 0,, oDeviceAlpha.pitch(), size, NPP_CMP_GREATER);