Counting the number of particles on an uneven background

Reading the newspaper I came across this image of HPV:

and having been acquainting myself with ImageJ, I went to the many videos online dedicated to counting or measuring specks on an image. The surprise was that, even if the viral particles on the image are incredibly conspicuous to the naked eye, the uneven grayish gradient in the background constituted a serious problem, which I was unable to work out by changing the brightness and contrast, or by applying filters.

How do you handle this problem of uneven background?

You can duplicate the image, and then apply a gaussian filter to the duplicated image.
Then substract the duplicated image from the original image and you get an improved result.

The apply a median filter to remove the noise of the blobs (if you don’t need to measure them).

Something like (I pasted your example from the clipboard, please adapt!):

run("8-bit");
run("Duplicate...", "title=background");
run("Gaussian Blur...", "sigma=40");
imageCalculator("Subtract create", "Clipboard","background");
selectWindow("Result of Clipboard");
run("Median...", "radius=20");
resetMinAndMax();
run("Enhance Contrast", "saturated=0.35");

Result:

You have to play with the values a little bit to get a decent result.

For measurments threshold the image and perform a particle analysis (extract only particles with Circularity x if necessary).

For other background removal tactics search in this forum or Internet for ‘ImageJ background removal’.
There are plenty of them.

3 Likes

Thank you very much for your reply. I am trying to find the “Subtract” option on the default ImageJ menu bar, but I only came across the “Subtract Background”. Is the subtraction of the duplicated image from the original not a function included in the basic ImageJ package?


Never mind… Process > Image Calculator > Operation Subtract

Thanks, again!

I agree with @Bio7 that doing a background subtraction is a good idea here.

I will also point out that even without a background subtraction, the TWS plugin does a nice job, even if you are very lazy about it:

The only change I made in the TWS settings was to turn on Variance—and I actually did not even try without doing that, so maybe it wasn’t even necessary.

After that, to convert the foreground into objects, perhaps the Ellipse split plugin is useful, although I did not try it.

2 Likes