Barnacle counting - is ImageJ appropriate

Tags: #<Tag:0x00007fd5483400b0> #<Tag:0x00007fd54833b768> #<Tag:0x00007fd54833b538>


Hi, I am trying to count the number and size of barnacles from a photograph. I have tried both “particle detection” and “template” type approaches but for particle detection the barnacles are often clustered tightly together which makes thresholding difficult (even when barnacle clusters can be well separated out). I then tried matching a template to just the “mouth” of the barnacle using template matching but this is not so reliable as this feature is a lot smaller and les well defined. I guess that data is just complex and I am wondering whether imageJ is the correct tool? Any suggestions as to better methods/ tools would be appreciated.


Hi @ckwkalk,

Welcome to the forums!

Could you share some raw images?

You should definitely consider the Trainable Weka Segmentation plugin - unless you’ve already tried this?

I’ve not yet used Trainable Weka Segmentation, but I have used your image for my first attempt. I drew in ROIs for the background and objects of interest and added them to the two different classes. I then applied the classifier to your image and converted to 8-bit grayscale and used the very basic watershed (Process > Binary > Watershed) to separate the barnacles up again. I’m sure you could work on this to make it better.

@iarganda will probably have an idea as to whether this is suitable or not.


Thanks @7rebor - I had tried the Weka plugin and got quite reasonable results in separating barnacle shell from rock (as you nicely demonstrated). However, identifying individual barnacles seems to be much more difficult - you can see that the watershed segmentation struggles as some large individuals are split into 5 objects and some clusters are not split at all. This led me to think that a “template” approach would be preferable. The “Template Matching” plugin producing some reasonable results:

. However this does not give the area of the objects just point coordinates. So any further suggestions welcome! (larger RGB image link as requested) - I cant upload attachments yet.



So… you might need to do a little pre-processing before any detection methods/tools. You have variation in background, etc. I am not sure this is the best (in fact, there are most likely better methods) - but I just did the following:

  1. Convert your image to 8-bit.
  2. Duplicate it and call the duplicate image “background”
  3. Apply a Gaussian blur (sigma = 250) the “background” image
  4. Use the Image Calculator and subtract the “background” image from the 8-bit original (create a 32-bit float).

Then you can try using Trackmate for particle detection. I know this is a tracking tool - but it’s object detection is awesome!

This is what I got for a first-go of your image after doing the above background adjustments (I used an estimated blob diameter 30 pixels):

So this could be an option for a workflow. Though perhaps the background method I used is not ideal - maybe someone else here on the forum has better insight on cleaning up your image a bit before detection?



Trackmate looks good (has given me some ideas for another project) and the detection certainly does better than the simple thresholding I have been doing so I will give it a go.