The nppiGraphcut_32s8u
function works on 32 bit signed integer edge capacities. In the grabCut example included with the CUDA 6.5 toolkit, they simply cast Npp32f
to Npp32s
. For example, from GrabcutUtil.cu
in the grabcutNPP example folder:
// Top/Bottom
Npp32s bottom;
bottom = _FIXED(edge_weight(center, tex2D(imageTex, x + 0.5f ,y + 1.5f), alpha, beta, 1.0f));
where edge_weight
returns a Npp32f
.
Did they scale up their numbers so that the edge capacities would be large values and thus avoid rounding off error?
It is not a 'cast'. Look at the implementation: _FIXED first multiplies the number by 10 and then calls a rounding routine.
So yes, the number is scaled up, although only by one digit.