I’m running the following to find connected components within an image and find their sizes:
nppiLabelMarkersUF_8u32u_C1R_Ctx(...);
int newNumber;
nppiCompressMarkerLabelsUF_32u_C1IR_Ctx(..., &newNumber,...);
nppiCompressedMarkerLabelsUFInfo_32u_C1R_Ctx(...,newNumber,...);
From what I understand, in order for the newNumber
parameter to the third function to be ready, I’d have to insert a call to cudaStreamSynchronize(stream)
to synchronize the calls before passing that parameter to the next function (otherwise the value passed might not have been changed yet- I’m assuming a call to cudaMemcpyAsync()
is used).
However, if I know for certain that there is a maximum number of connected components that can be present in the image, can I pass that maximum to the labels info function as long as I provided a large enough host memory for the infos?
Or does the CompressMarkerLabels
function synchronize the stream since it’s returning a host value?
Also, out of curiosity, why isn’t there a nppiCompressedMarkerLabelsUFInfo_32u_C1R
function (without the NppStreamContext
parameter)?