Calculating Object Sizes in Drone Images

The author, along with a colleague, is experimenting with drone calibration. Picture by Nancy Alice/ TfW.

Currently, my focus lies in solving the intriguing problem of calculating the size of objects in drone-captured images – a recurring maths problem in our conservation work. In this case it was to be able to estimate the size of a Ganges river dolphin as captured in videos using small quadcopters. Setting this workflow is foundational as solving this problem could help us and other conservationists in a number of areas including, but not limited to, estimating the demographic distribution of animal species, calculating garbage hotspot sizes, sizing up the footprint of an image, tracking an individual animal’s body condition over time, and more.

As it turns out, this problem has already been solved, at least under certain assumptions. There are a couple of ways to calculate the size of an arbitrary object, some of which are elaborated upon in this blogpost.

A First Step

Images are made up of pixels and usually, pixels are small squares. We are going to assume that we have square pixels. Each element or distinct object one can see in an image is made up of pixels. Since we want to measure the real-life size of an object in an image, one way of doing that is to use the number of pixels occupied by that object. If we know how many pixels it occupies along with how many real-life centimetres/metres each pixel corresponds to, then we can calculate:

Area of an Object = Number of Pixels in the Object * Area Occupied by a Pixel in Square Centimetres

⇒ Area of an Object = Number of Pixels in the Object * GSD²


Where GSD (Ground Sampling Distance) is the distance between two consecutive pixel centres measured on the ground or the distance a side of a pixel represents. Here, it is the centimetres the side of a pixel denotes.

This also works under the assumption that all pixels are of the same size, and additionally denote the same real-life centimetres. Our formula won’t work if different pixels capture different amounts of distances on the ground, say, if one pixel captures 1 cm while another captures 10 cm of the ground.

Thus, our immediate problem becomes to find the GSD. Counting the pixels making up an object can be done rather trivially.

Diagram showing how to calculate the area occupied by an object of interest in an image.

The following is the description of the problem statement. 

There is an image, I, which has been taken from a drone, UAV, flying at a height, H. The dimensions of this image are I_W, I_L, and, I_D, corresponding respectively to the width, length, diagonal dimension of the image as measured in pixels. Additionally, the actual real-life area being captured has the following corresponding dimensions: A_W, A_L, and, A_D, measured in metres (m).

The dimensions (in pixels) of an image I, as captured by our drone’s camera.

The real-life area captured by our drone’s camera. Different dimensions of the area have been marked.

A nadir image is one which is taken with the drone camera pointing straight down at the ground. This image has been taken in a nadir position.

Diagram of our drone capturing a nadir image of the ground at a known height or altitude.

Additionally, the drone has a camera which has a focal length, F, and a sensor to capture the image with dimensions, S_W, S_L, and S_D, corresponding respectively to the width, length, diagonal dimension of the sensor as measured in millimetres (mm). All of these are the real sizes and not 35mm equivalent dimensions.

The dimensions of the camera sensor have been illustrated here.

The next parameter is the field of view or FOV. This is expressed in degrees. Sometimes, people call it angle of view instead. This again is different for the width, length, and diagonal of the image as there are different amounts of areas being captured corresponding to each of these dimensions. So, we have three views with us: FOV_W, FOV_L, and FOV_D.

Diagram of the field of views corresponding to the length and width of the area being captured in our image. The point where the field of view angle forms from is the lens of the camera.

The final parameter is the one we are interested in finding out, GSD. As defined earlier, this is the real-life, actual distance each pixel side represents. Thus, the distance per pixel side. If we have the distance, in centimetres/metres, covered by the width or length of the image and then divide it by the number of pixels covered by that dimension in the image, then could divide the distance by the pixels to get the GSD. Thus, we have:

GSD (m)= A_W/ I_W = A_L/ I _L

Where (m) indicates that the GSD is measured in metres.

Now, let’s jump into actually solving this problem.

Our First Approach

This consists of an easy approach to estimate the areas covered by the image by using some basic trigonometry. Refer to our short yet detailed tutorial on solving this exact problem in one of our previous posts back in 2019, for details and derivations for the formula used:

Diagram showing the relationship between our drone’s sensor, the camera lens, and the area being photographed/ captured.

A_D= 2 * H * tan(FOV_D/ 2)

A_W= 2 * H * tan(FOV_W/ 2)

A_L= 2 * H * tan(FOV_L/ 2)

Alternatively, we can also find A_W and A_L using the aspect ratio, r = I_W/ I_L and the fact that that A_W, A_L, and A_D form a right triangle, as follows:

A_L = A_D/ √(1 + r²)

A_W = r * A_D/ √(1 + r²)

Now, for calculating the GSD, we have:

GSD (m) = A_W/ I_W = A_L/ I_L

Tada! We are done with the first approach. If following this was tough, this video explains this approach very well as well.

Our Second Approach

Another common way to solve this problem is to use similarity to derive the more commonly used formula for calculating GSD.

Diagram of the triangles formed when using a drone to capture a Nadir image of the ground. Applying concepts from ‘Similarity’ allows us to derive a formula for the GSD.

If we take a look at how our camera sensor captures an image of the ground, we can see that there are two triangles that are formed, △AOB and △COD. Both of these triangles have a common angle i.e FOV = ∠AOB = ∠COD. The FOV being used here depends on the dimension of the sensor we are looking at. If AB is the diagonal of the sensor, S_D , then FOV_D = ∠AOB = ∠COD. In that case, A_D = CD. Similarly, if AB is S_W, then A_W = CD.

Since AB || CD, we see that ∠OAB = ∠ODC and ∠OBA = ∠OCD since they are alternate interior angles.

Since three corresponding angle pairs are equal in both the triangles, we have similarity by AAA criterion, △AOB ~COD. As a consequence of similarity we know that the ratio of the areas of similar triangles is equal to the square of the ratio of their respective sides.

AB²/ CD² = (1/2 * AB * F)/ (1/2 * CD * H)

⇒ AB/ CD = F/ H

⇒ CD = AB * H/ F 

Because AB and CD can represent either the diagonal, width, or the length dimensions,

A_D = S_D * H/ F

A_W = S_W * H/ F

A_L = S_L * H/ F

Finally, since we know that

GSD (m) = A_W/ I_W = A_L/ I_L

We get,

A_W = GSD * I_W = S_W * H/ F

⇒ GSD (m) = S_W * H/ (I_W * F)

Similarly,

GSD (m)= S_H * H/ (I_H * F)

Tada! We have done it once again. We have solved the crisis of the missing GSD! And that’s a wrap! 

In conclusion, choosing the appropriate formula from the above depends on which parameters you can access and trust. As an example, you might have found the focal length of your camera for a given setting through the EXIF data, but then maybe you don’t trust the data being reported. On the other hand, you might know the default field of view of your camera from its official documents but then, you find out that the field of view keeps changing from one mode of the drone to the other, for different aspect ratios, zoom levels, etc. (it is quite a mess). 

Going through all these formulae and deriving them was a fun and educational experience. It gives us a clearer understanding of the caveats of using drone parameters in scientific research. We are now using these to estimate the size of river dolphins in the Ganges and better understand their age, body structure and health.

We hope you find this useful for your work- have fun and tread carefully. If you have any comments, or use some completely different way to solve this problem, we would love to hear from you- write to us at <contact@techforwildlife.com>

Cheers!

Here Comes the Drone

Field notes from Bihar, 2023.

As the sun set after another day of fieldwork, we returned to our accommodations. I recounted the day's events while transferring media. We spent the morning in the field, followed by a quick lunch, and then returned to the field. Later in the evening, we prepared for an upcoming workshop with the forest department. Our days in sunny Bihar this February had been exciting.

Our day was indeed full of action, conducting aerial transects to estimate gharials at our field sites along the riverbanks of the Gandak. We scanned the waters intently, hoping to catch a glimpse of life beneath the surface. The splashes and movements in the water kept us on edge, wondering if it was a dolphin or something else entirely. Moving to another site on the north bank, we got started on our drone transects, and that's when things took an unexpected turn – a buffalo nearly charged us! The adrenaline rush was real, but we pushed through, even laughing, completing our tasks and moving on to another location to observe dolphins. During our time on this site, we counted four gharials and a solitary dolphin, while also spotting an enigmatic stork.

Evading a curious buffalo on field-site.

After wrapping up our fieldwork, we returned to charge our drones and have a quick lunch. Our tasks for the day weren't done yet – we were headed to another site near our accommodations for mapping and conducting bathymetry tests soon after. Bathymetry tests involve measuring the depth of water bodies, in this case, of the river. By initiating the flying of the drones over the same river channel, our objective was to ascertain whether RGB drones could provide any information regarding the river’s bathymetry.

Once the media we had gathered were transferred, we set off for our next site. Though the plan didn't unfold exactly as anticipated, the unexpected offered new opportunities. The survey boat was unable to go around the sandbar as intended. Instead, we flew the drone following the boat's path to take pictures at frequent intervals along the same route. This was a way to conduct simultaneous surveys using two different techniques: not only exploring the presence of dolphins but also comparing methods used.

Survey boat as seen from the aerial drone.

The integration of drone technology has repeatedly demonstrated its potential in conservation efforts. Drones' capabilities to swiftly and comprehensively survey areas can reshape how researchers and conservationists approach their work. High-resolution imagery captured by drones works to bridge the gap between traditional survey methods and modern technology, enhancing data accuracy and efficiency. For those of us fortunate enough to witness the impact of drones on conservation firsthand, tangible feelings of excitement and curiosity emerge.

It was during this flight that the true excitement around drones became evident. As the drone took to the sky, a group of children gathered around, captivated by the spectacle. Their excitement was contagious, as they curiously identified the drone and spun imaginative stories about its purpose, whilst mistaking my hand-held camera for a CCTV! In a sense these robotic ‘toys’ facilitated a more accessible dialogue about wildlife.

Children taking turns viewing from a pair of binoculars, whilst the project team conducts a mapping mission from the banks of the river.

The stunning illustrations of local wildlife prepared by the GCA and Madras Crocodile Bank shared by Tarun Nair as part of his presentation to the forest department.

The evening was one of light chatter and marvelling at the rich diversity of this region. A glimpse of the stunning illustrations of local wildlife, compiled by Tarun Nair as part of his presentation to the forest department, served as a reminder of the beauty we were working to protect.

The excitement and curiosity surrounding drone technology for conservation are undeniable. With each passing day, more researchers and conservationists turn to drones, gaining insights into our natural world. Being a part of this field is a privilege, and I'm excited about the future and the positive impact drones can have on conservation.

2023 at TfW

As we step into the new year, we reflect on the progress, challenges, and collaborations that have defined our journey in 2023. The loss of our founder-director, Shashank Srinivasan, has been a profound moment for our organisation. Despite the challenges, we remain committed to our mission of amplifying conservation impact and express gratitude to our collaborators, donors, and well-wishers for their continued support.

TfW core-team in discussion, Jan 2023.

We commenced the year with an in-person team meeting to discuss our objectives and goals for the first quarter.

At the end of the week, we made simultaneous in-person presentations. One was at Ganpat Parsekar College, Arambol as part of a state-level workshop supported by the Directorate of Higher Education, Goa. We spoke to students about the use of technology for conservation. The other was a presentation on the transmission line through Mollem at the inaugural meeting of the Goa Development Group at a seminar on Goa's economy and society, hosted by the Goa Institute of Management.

Nandini Mehrotra presenting on the use of conservation technology.

TfW with Dr. Nandini Velho in Mollem National Park.

In the following week, we undertook our first field trip of the year to Bhagwan Mahaveer Sanctuary and Mollem National Park. We looked at linear infrastructure features cutting through the park.

Alex identifying boundaries of the forest land in Mhadei.

TfW mentoring students of Srishti for a studio. Picture courtesy of Himanshi Parmar.

In mid-January, we visited Alex Carpenter and Cristina Toledo near Mhadei Wildlife Sanctuary in Goa, where they focus on restoring private forest land. Here we initiated our collaboration of experimenting with a combination of ground, UAV and satellite-based data to aid restoration activities.

Also in January, we mentored students at Srishti Institute of Art, Design and Technology for a studio on environmental design taught by Himanshi Parmar.

 Nandini Mehrotra in discussion with the CILS5 cohort. Picture courtesy of Pakhi Das.

In February, we took part in the Fifth Central Indian Landscape Symposium (CILS5) near Kanha National Park. Hosted by the Network for Conserving Central India (NCCI), this acts as a platform for stakeholders to discuss conservation challenges in the region. Nandini Mehrotra, our Programme Manager, attended the conference and held an interactive session on the use of technology for wildlife and environmental conservation.

TfW conducting field-work in Bihar.

We have been working with Wildlife Conservation Trust, India (WCT) exploring the use of UAVs for the study and conservation of Gangetic river dolphins and gharials. In February, we successfully completed our second field trip to Bihar with WCT, conducting aerial surveys of behaviour and population estimation of these vulnerable species.

Introducing Bihar FD to the use of UAVs for conservation.

Following the field surveys, both organisations jointly organised a comprehensive day-long training workshop for the Bihar Forest Department. The workshop, centred on monitoring threats to river-floodplain wildlife in the Gandak River, served to enhance the skills and knowledge of frontline forest staff.

Team viewing live-stream of olive ridleys through the drone-controller.

Each year, hundreds of thousands of olive ridley turtles nest on the beaches of Odisha before returning to the sea. In March, we conducted fieldwork in Odisha to assess the feasibility of using drones for studying near-shore olive ridley turtle aggregations, as part of a three-way collaboration with WWF-India and Dakshin Foundation.

During a joint field survey we captured aerial footage revealing these turtles as small white dots off the coast of the Rushikulya mass nesting beach. Additionally, we gathered aerial video-transects of near-shore turtle aggregations and generated orthomosaic maps of nesting beaches.

During the first weeks of March, Goa's Western Ghats experienced intense fires. We created burn scar maps to identify affected forest areas, to inform future restoration projects. Our conservation geographer, Sravanthi Mopati, detailed the steps to create these maps in a blog as well.

In March, we also crafted a story map explaining the linear infrastructure projects proposed through Mollem in 2020 and summarising updates on the proposed projects since then.

Aditi Ramchiary presenting to high school students on TfW’s work.

We also spoke to high school students about our work and the use of technology for conservation on an educational trip organised by Journeys with Meaning.

Towards the end of March, the core-team gathered in person to review the first quarter, assess ongoing tasks, and plan for the upcoming months.

Also during this month, we unveiled the illustration created by Aashti Miller for TfW. Highlighting some of the different species that we have had the privilege to work with, the illustration conveys the nature of our work towards creating meaningful impact, by the use of appropriate technology for the conservation of wildlife and the environment.

We conducted phase one of an internal capacity building workshop on the use of vector design tools for cartography, and refined our spatial analysis workflow.

In April, we made the most of our time away from the field by analysing data, documenting methodologies, and creating communication material from our field work.

Illustration by Aashti Miller.

Artwork by Svabhu Kohli.

On 22nd April, 2023 we faced an unexpected and heart-wrenching loss with the sudden passing of our founder-director, Shashank Srinivasan. His vision for conservation, with his leadership, passion, and conviction are the driving forces behind this organisation's existence. While in this profound grief, the outpouring of support from all quarters helped us regain stability in the ensuing months.

TfW in Mhadei, May 2023.

TfW core-team, June 2023. Picture courtesy of Supriya Roychoudhury.

For our final field trip before the monsoon, we revisited Alex and Cristina's restoration project near Mhadei Wildlife Sanctuary. We used our UAVs to look at the effects of recent forest fires, the detrimental impact of invasive species and map parts of their plot as pilot sites for targeted assisted regeneration as well as control sites.

Later in May, we gathered in person at a co-working space in Goa to work together as a team on alternative days of the week. We also completed the second phase of our counter-mapping work with our collaborators for NID Ahmedabad.

Map output from the counter-mapping exercise.

Through the summer, from April till July, we produced 21 maps for 10 stories as part of our collaboration with Mongabay-India to use cartography to broaden conservation communication for environmental journalism. August marked the completion of our two-year commitment with them. Read more the stories we have worked on together here and explore our blog-posts for the process of visualising them


In August and September, we worked on cartography for 'Fish Curry and Rice' - a book detailing Goa's ecology and environment. Written and compiled by the Goa Foundation, it was first published in 1993, and is currently being updated for republication. As the cartographers, our goal for this project is to provide a spatial view of Goa's environmental landscape and create meaningful visuals for readers. We created over 20 outputs for publication- with revisions in October and December.

Screengrab from an internal capacity building workshop.

In September, we conducted the second phase of our internal workshop, focusing on the effective utilisation of vector design tools for cartography. During the same month, we had a meeting with WWF-India in-person in Goa to explore collaboration opportunities based on our joint efforts earlier in the year. 

Also in September, we were profiled to be part of a climate report 'Our Uncommon Future,' created by Dasra and the Observer Research Foundation. The report lists us alongside fellow CSOs championing for creative climate solutions through collaborative, multi-stakeholder methods.

In October, we extended our support to citizens in Assagao on using free and open-source tools to document the forests around them. Simultaneously, we marked the beginning of the final phase of our report on the use of drones for conservation in India, by seeking reviews and feedback from the interviewees. 


A special photo exhibit showcasing Shashank’s work in Ladakh was featured as part of the GDN Conference 2023 by the Global Development Network in Quito, Ecuador, during the first week of November. This exhibit, curated by Supriya Roychoudhury and TfW offers a glimpse of his work in this incredible landscape.

Aerial view of mangroves in Goa.

We have been selected as exhibitors and grantees for Science Gallery Bangalore’s exhibit on Carbon. We began work on the exhibit in the monsoon,continuing to refine our outputs through October and November. Our exhibit revolves around remote sensing methods to estimate carbon sequestered by mangrove ecosystems. We have compiled research and methods conducted over the last two years combining drone and satellite data. For this exhibit, we have also collaborated with visual artists who have interpreted our scientific outputs and analysis through multimedia. The exhibit will be open for the public soon in Bangalore and will also feature a website with digital material.

Aditi Ramchiary at her farewell. Picture courtesy of Nandini Mehrotra.

In November we bid a bittersweet farewell to our core-team member, Aditi Ramchiary, as she embarks on her journey towards an academic career. In her time with us, Aditi had numerous firsts and achievements. She skillfully blended her artistic and technical abilities, resulting in a distinctive aesthetic that made her a highly effective cartographer. In her parting blog, she talks about her experience with TfW which was also her very first job.

In December, we had exciting changes in our core-team. We welcomed Ishan Nangia, who will contribute to computer vision analysis in various projects. Ishan is a coder and a diver and is presently working with us on using computer vision to aid restoration planning. We also welcomed Dr. Madhura Niphadkar as an advisor to the same project.

TfW in discussion with the Asian Flying Labs. Picture courtesy of Anuj Pradhan.

At the beginning of December, our team travelled to attend conferences. In Delhi, we partook in the WeRobotics hosted Asia Retreat for Flying Labs, representing our work in conservation drone technology as co-leads of India Flying Labs. Simultaneously, Nandini Mehrotra, attended Ecological Restoration Alliance’s Restoring Natural Ecologies 2023 retreat in Panchgani, Maharashtra.

Identifying species from aerial footage as part of the workshop on restoration in the Western Ghats.

Mid-December, we conducted a day-long meeting cum workshop to make progress on the restoration project in the Western Ghats. Our team examined samples of our field data with Alex and Cristina- our partners on the ground. We were joined virtually by remote sensing expert Dr. Madhura Niphadkar and Dr. Kartik Teegalapalli, an expert in forest recovery. Based on our discussion on potential methodologies, we are currently testing a combination of computer-vision aided analysis of UAV footage along with satellite data and analysis, based on the input and on-ground expertise that Alex and Cristina provided.

We also began work on a new project with the Sciurid Lab of IISER Tirupati. In a virtual meeting, Dr. Nandini Rajamani and Harsha Kumar talked our team through the research that the lab is currently focusing on, and helped us understand more about the species they work with. We then explored avenues of research and the possibilities of using a combination of computer vision and spatial analysis to further explore data collected through our previous field work with the lab in 2022.

Last team-call of 2023.

As the year drew to a close, we concluded with a team call, summarising the events of the year, sharing personal and work reflections.