I'm trying to identify contours using a Canny filter in openCV and fill the contours, in order to create a mask. I've got this kind of starting image:

I'm trying to identify all features in my image, draw the contours, and fill them. I'm trying to implement it with this code in openCV:
img = cv2.imread(os.path.join(fName,f), 0)
img = cv2.GaussianBlur(img,(5,5),0)
cv2.bilateralFilter(img, 9, 150,450)
edge = np.zeros((img.shape[0] + 2, img.shape[1] + 2), np.uint8)
edge = cv2.Canny(img, 500, 300, apertureSize=5)
cont, heir = cv2.findContours(edge.copy(), cv2.RETR_LIST,cv2.CHAIN_APPROX_SIMPLE)
contours = [cv2.approxPolyDP(cnt, 3, True) for cnt in cont]
cv2.morphologyEx(img, cv2.MORPH_CLOSE, np.ones((5,5), dtype='uint8'))
cv2.drawContours(img, contours, -1, 255, -1)
plt.imshow(img, cmap = 'gray', interpolation = 'bicubic')
plt.xticks([]), plt.yticks([]) # to hide tick values on X and Y axis
Mostly, I'm guessing at the parameters (trial and error; it's hard!). Unfortunately, rather than neat outlines, filled in with white, I get something more like this:
Are there any thoughts? Clearly, I need to close edges better, and adjust some of my Canny parameters, but I could really use some guidance.
Thanks!
EDIT: Thresholding doesn't do a very good job of creating the kind of mask that I want, either:
I think that my 'bright' dots aren't sufficiently brighter than the background, but I'd like to be able to have white dots on a black background.
Code:
img = cv2.imread(os.path.join(fName,f), 0)
cv2.bilateralFilter(img, 9, 90,16)
#img = cv2.GaussianBlur(img,(5,5),0)
#binImg = np.zeros((img.shape[0], img.shape[1]), np.uint8)
binImg = cv2.adaptiveThreshold(img, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 25, 2)
#binImg = cv2.threshold(img, 0, 255, cv2.THRESH_BINARY+cv2.THRESH_OTSU)
#newimg = np.multiply(img, np.divide(edge, 255.0))
plt.imshow(binImg, cmap = 'gray', interpolation = 'bicubic')
plt.xticks([]), plt.yticks([]) # to hide tick values on X and Y axis
#plt.show()
