How about a morphology approach?
Dilate the thresholded image by some number (depending on the target density of dots) then dots in a cluster will appear as a single object.
OpenCV supports morphological operations (as would a range of image processing libraries):
http://www.seas.upenn.edu/~bensapp/opencvdocs/ref/opencvref_cv.htm#cv_imgproc_morphology