Counting objects and measuring area in images

11 May
2021

Using a common photo-editing software to count particles and measure areas on microscope images.

Background

Adobe Photoshop is a photo-editing software, but It is also very useful in science. The powerful interface and image analysis is perfect for analysing visual results such as microscope images and colonies on petri dishes and many more applications.  There are however many other (free) photo-editing software which have these capabilities.

The select colour range function allows a specific colour range in an image to be selected. Then a numerical output is given of the number of pixels selected. Like this, the % cover of the image or number of things of interest in the image can be quantified.

This was used in the project An investigation into the removal of microplastics from water using ferro-fluids to measure the amount of microplastics in a water sample.

Steps

Obtain the image to be examined

This method can be used for images where the area you want to quantify is a different colour to the rest of the image. For example, in a microscope image of algae in water, the water will often appear  white and the algae green. This will be easy to measure.

In images where the colour contrast is not so great, try changing the image to black and white to make what you want to measure stand out more.

Open the image in Adobe Photoshop

Adobe Photoshop is a very useful software which can be obtained as a free trial or paid subscription. There are discounts available for students and educators. Other photo editors with a select colour range tool may also work similarly for this method. 

When you open Photoshop, you will be faced with a screen telling you to either create new or open a file. Open the image you want to analyse by pressing open and selecting the image you wish to analyse.

After opening the image, you can (optionally) edit the image to make the things you wish to count stand out by changing the brightness and contrast from the image - adjustments at the top of the screen. If at any stage you make a mistake or are not happy with what you have done press ctrl + z to undo (you can do it multiple times for big errors).

Use the Select-colour-range tool

The Select colour range selection pane

Click Select at the top of the screen to expand the selection options and select colour range. A box will appear and your mouse will turn into a little dropper.

The select colour range tool has a box on top with select written beside it. If you click into this box it allows you to choose how you wish to select. You can choose a colour such as greens and all green tones in the image will be selected. I like to use the sampled colours option since this allows me to define which colours I want to select.

The Fuzziness slider allows you to select how big the area needs to be to be selected. The box below shows in white the area of the image selected and black that that is not selected.

The three dropper icons below the save button specify how you wish to use the dropper. The dropper with the + beside it adds to colour range. The dropper with the - removes from the colour range. The dropper with nothing beside it only selects a single colour.

Select areas of interest

An image of microplastic in water with the colour range of plastic particles selected

Using the sampled colours option, and the dropper icon set to the dropper with the + beside it (adds to colour range) click on the areas you wish to select. i.e. in my case, the microplastic particles.

Once you are satisfied with the selected area (only the areas you wish to have selected and therefore counted should be visible in white on the select colour range dialog box) then click save to save the colour range preset allowing you to use the same parameters for future selections and images.

Once saved click Ok on the select colour range box to select the areas of interest.

The areas you want to count / quantify should now have dotted lines around them showing that they are selected. If you are not happy with the selection, navigate up to select and press deselect to get back to a canvas which is not selected.


Use the output to count what you are examining

Histogram tool

Now that the areas of interest are selected, you can find out how many pixels are selected (in my case: how many pixels are covered by the bits of plastic in the image). For this navigate the window at the top of the screen and select Histogram.

A box will appear, click on the three lines in the top right corner of the box and select Expanded view. Now in the bottom of the box, Pixels followed by a number is shown. This number is the number of pixels selected. Take note of this number.

Now to obtain the total number of pixels in the image, navigate to Select and press Deselect. The number beside pixels in the histogram box should change. Take note of this new number, this is the total number of pixels.

To calculate the percentage of the image covered in whatever you sre measuring (in my case microplastic particles) divide the number of pixels selected by the total number of pixels in the image and multiply the result by 100.

Resources

In this tutorial, Adobe photoshop was the primary software used. There are student discounts availabe for it's use.

The select by colour tool can be used similarly in the free photo-editing software Gimp.

DNA Extraction
Life Science

DNA Extraction

DNA (deoxyribonucleic acid) is a protein found in all living cells that acts as a set of biological instruction. In this tool, we see how DNA can easily be extracted from fruit. Although DNA is a very small molecule, when collected from thousands of cells it is visible to the naked eye!

by:
Amino Labs
Jan 20, 2022
add
Add to saved tools
check
Saved
more_horiz
Please wait
Basic intro in RStudio
Computer Science

Basic intro in RStudio

RStudio is a great interface to work with the programming language R. You can learn the basics of using RStudio in just a few minutes in this tool!

by:
Ella Rees-Baylis
Jan 20, 2022
add
Add to saved tools
check
Saved
more_horiz
Please wait