If the output of your Gábor-filter is reliable and the variation in your image-data is not so high that the outcome looks completely different, then you can use the following approach (parts of it where already mentioned):
Binarize your second image with any automatic thresholding algorithm. The range of thresholds which will work is large as you will see.
Use a component labeling algorithm to label each connected region of pixel with a unique value.
Calculate for every component of your image a property which describes, how close your object is to a filled circle. For this, you can use for instance the compactness. I used below the fraction of pixels within the equivalent disk radius. This radius is the radius a disk with the same area as your object would have.
- Area is simply counting the number of pixels of your object
- Calculating the radius of a circle given its area should be manageable too
- For the pixel inside this radius, you need the center of each image object, but this is just the mean of all positions of the object-pixels. If you are a physicist then you know the center of mass of several point-masses. This is equivalent.
- Now you calculate for every pixel of each object the distance from its center and check whether or not it is smaller then the circle radius. Dividing the two numbers and you get the fraction of inside and outside pixel.
- Take the object with the highest fraction. Note: objects with only one pixel will get a value of 1. So you should set a size-threshold and take only objects larger, say 10 pixel.
To see, that an automatic binarization should work, here are the results for a very low and a very high threshold:
Update Component Labeling
The choice of the component labeling is not critical for your application. I would suggest, if you have to implement it by yourself, to use a very simple method. The one pass version from the Wikipedia site is very easy. Basically you iterate through your binary image and when you meet a pixel which is white and is not already labeled you use a new label to for this object and start with this pixel.
The process of labeling this object with a label is basically similar to a flood fill. This is on the Wikipedia-site the inner steps 1-4 in the algorithm. You start with this labeled pixel and put all its neighbors on a stack (they used a vector). For a pixel on the stack you check whether it is foreground and not already labeled. If you have to label it, you put again all its neighbors on the stack. Do this until your stack is empty.
Then you continue your scan through the image. Unlike the description on the Wiki-site, you don't have to remove a pixel from your original image, you just skip when you have a value different from 0 in your label-image.