Count black objects

segmentation
Tags: #<Tag:0x00007fb87ce67f80>

#1

Hello,
I have a problem with the black objects, i can’t count them.


#2

Could you please upload one or two images to clarify better your issue?
thank you
Emanuele Martini


#3

Original Tiff file: download


#4

In fact, I have a problem with the reflection of light on black objects and their counting too


#5

the problem of the reflection light produces everytime more or less three white spot on the black objects?
can we identifiy the number of white spot in the black area and then divide them by three to have good estimation of the number of black objects? or would it be to much naive?


#6

There are objects that have 3 points and other 2 points


#7

In a very quick trial using Trainable Weka Segmentation (with the standard settings, and a third class added for the background), I got the following result:

I assume that with some post-processing, it should be fairly easy to filter the objects of interest by size and shape to get a robust count. See also:


The center of cells
The center of cells
#8

You can give me please a link to install Trainable Weka Segmentation ?


#9

I linked it in my post above. Trainable Weka Segmentation comes included with an installation of Fiji:

You can find it using the Command Finder L, or under Plugins > Segmentation > Trainable Weka Segmentation


#10

Good day Emna,

would the following be an acceptable count?

It gives 114 recognized black spheres without using a classifier (weka).

Please be aware that a 100% correct number is generally out of reach.

Regards

Herbie


The center of cells
#11

Yes I can count them manually but I would like to have a function that counts the number of pariculates per color


#12

Good day Emna,

was this a reply to my post?

Actually, the posted image shows an automatically gained result, or at least a semi-automatic one. Depending on the image quality you may have to adjust one parameter.

The approach consists of three steps:

  1. color-threshold
  2. correlation with a prototype sphere
  3. analysis of maxima

Apart from my suggestion I wanted to know what precision of the number estimate is required.

regards

Herbie


#13

Dear Herbie,

would you mind explaining step 2 in more detail?

Thank you,
Martin


#14

Good day Martin,

well, with correlation I evidently mean the computation of the cross-correlation function.

It’s just the same as e.g. searching all positions of letter “e” in a text page, provided you have one letter “e” of the correct font available as an image.

ImageJ can compute the cross-correlation function of two images (e.g. the text page and the prototype “e”) via complex-valued multiplication in the Fourier-spectral domain. As always, a look at the relevant pages of the manual reveals more details:
https://imagej.nih.gov/ij/docs/guide/146-29.html#toc-Subsection-29.10
(especially: 29.10.7 FD Math… )

HTH

Herbie


#15

How about just blurring the shine? This gives me 128. Herbie’s method is probably more robust though.

Gaussian blur 3, Color threshold, find maxima


#16

Dear @Emna,

I have just thresholded with the default method of ImageJ the image and set some area constraints to the object to find (i.e. 20-100) with Analyze Particles tool.
Then, supposing that the great majority of the black balls have 3 bright spots I divided the number of ROIs by 3.
I found 373 ROIs /3 = 124 black balls; this number is more or less comparable to the number other has found with other methods.
So now you’ve a lot of methods and approaches to test.

I compared them to a count of them done by hand (points in green on the below image)

by hand (by my hand :wink: ) they are 137.
So it obviously underestimates, but it is not so bad.

As many of us pointed out to you it would be kind by you tell us how much precise you want the estimation of the number of black balls.

But ok, we really don’t know if you are still reading us trying to help you;)

have a nice day,
Emanuele Martini


#18

I do not have an estimate of number but I always try to see is what the count could detect all the particles or not


#19

Excuse me for the delay. Thank you very much for your help emartini and especially for the time you spent. I will try this method because if there is a 10 difference it is not a problem


#20

ok @Emna,
nice! :wink:
let me know if it works fine and if you have some “implementation” problems.

have a nice day
Emanuele Martini


#21

Yes, I have a question, how could you detect only the white spots? Because if I put in circularity 20-100 it will detect all the particles