Centroids (weighted) & CCL in CUDAfy.net

Feb 2, 2015 at 4:47 PM
We have a 8bit greyscale image with lots of star-like objects. We are currently finding the weighted centroid with Matlab using:
mask = image(:,:) > threshold;
ccl = bwconncomp(mask);
ctroids= regionprops(ccl, image, {'Centroid', 'WeightedCentroid'});
centroids = cat(1, ctroids.WeightedCentroids);
We need to stop using Matlab, and go to a pure CUDA solution. The IMAGE array is already in GPU global memory (from earlier CUDA kernel process steps). So we are looking for open source code that we can use to do the rest of the centroiding.

Perhaps I am missing something but my searches are not turning up useful sources. Also These all seems to require libraries that are not present in CudaFy.net.
  1. GPU Gems (http://hpcg.purdue.edu/bbenes/papers/Stava2011CCL.pdf ) just the CCL stuff, the FindRoot algorithm is not clear to me from pseudo code. But probably the best start (where is weighted centroiding? inGPU Gems?). I also see Google saying they have a faster solution. but their solution is completely opaque to me: https://code.google.com/p/gpu-2d-binary-ccl/
  2. ArrayFire (http://www.arrayfire.com/docs/group__image__func__cpp__centroids.htm ) I like the simplicity, but we need Weighted Centroids, and also, I would love to see a explanation of the algorithm. Also they seem to assume C++ arrays, and our data is already in the GPU. I don't want to copy it back and forth.
  3. OpenCV. I can't find the correct routines, and I don't need the full GPU library, just the CCL and centroids. Also it seems this library also expects the data to be in the host to begin with, and to return to the host. Can I just get a snippet of the source code?
Perhaps I am just not looking hard enough at the libs. Or perhaps there is a better place too look?