Steve's Herpetological Blog

An insight into the life of Steve, his research and the many books he reads

#SciFri

#SciFri: Working out canopy cover using ImageJ – How To

Hey everyone! A number of you have asked me how to use ImageJ to determine canopy cover following my previous #SciFri post. I didn’t make it explicitly clear and so now that is what I intend to do! Before you do anything, make sure you have Fiji downloaded and ready to roll on your machine (it’s a specific package of ImageJ with a number of added bonus features compared with the original).

First of all you need to take a photo of the canopy you want to measure, I recommend using a fish-eye lens attachment to either your DSLR or your mobile phone. Once you’ve taken the photos, import them to your laptop and crop accordingly. Next you want to transform them into a binary image (like that below), to do this go to Image > Process > Make Binary and once the step is complete, ensure that the image itself is 8-bit. I’m not talking about the Nintendo NES here, it’s probably also a good idea to save each of the binary versions of the original as a separate file so you don’t mix them up. If it isn’t you can go to Image > Type > 8-bit and then save to ensure the image is in 8-bit format.

A binary canopy photo after it has been processed

Once you’ve successfully transformed all of the images to binary, you can begin the next stage. Depending on the conditions of which you took your photo in, you may need to play around with the colour and brightness thresholds in order for your binary image to be the best representation possible. I’ve found that too much dark cloud or direct sunlight often sees me playing around with the settings to ensure that optimum threshold is found (through Image > Adjust > Threshold). Hopefully you will have a lot more ease than I, but if you do get stuck there is plenty of guidance online.

Once you’ve finally got the binary image all saved and loaded back in again, it is time to start measuring the canopy cover! There are multiple different ways to do this, but given the circular nature of the images due to the use of a fish eye lens, this method has worked best for me. You need to choose the Elliptical Selection tool which allows you to draw circles and ellipses. With the outline of the image as a guide, draw a circle around the area you want to measure the canopy cover of. This should be easy given the nature of a fish-eye lens. Once you’re happy with your selection, go to Analyze > Tools > ROI Manager  and click ‘Add’.

Once the Region of Interest (ROI) has been selected, you can set the measurements that you wish to make. To do this it is as simple as going into Analyze and then Set Measurements. I’m measuring canopy cover in this example so I always choose the ‘Area’ tick-box but as you can see there are a number which you could also use. Once the measurements have been set up, go back into the ROI Manager and highlight the selection you’ve just made. Then click ‘Measure’ and you’ll get a percentage of cover for the white pixels, to convert this into canopy cover (the black pixels) – just subtract from 100. Repeat this process until you’ve managed to work out the cover for all of your photos.

If you’ve got any problems or questions, please do let me know below and I’ll cover them in a future instalment of #SciFri. I hope you found this useful!

LEAVE A RESPONSE

Your email address will not be published. Required fields are marked *