Close

Tree Detection in OpenCV

Published on Apr 15, 2014.

The Robotics Vision team has recently been in collaboration with Matthew Sichenze, a computer science major at Northwest Nazarene University, Nampa, ID. Matthew is developing an algorithm for detecting and counting trees in images to be used in conjunction with our aerial crop monitoring system.

The algorithm uses OpenCV, which is an open-source toolbox for computer vision. At a basic level, the algorithm uses a path of centers and a box that represents the search area. On each section of the path, a rectangular portion is cut out and tested for the presence of a tree. Each rectangular portion is tested by comparing the number of tree pixels to the number of background pixels. If the comparison yields a high percentage of tree pixels, then that area will be identified as a tree.

Original Test Image:

Pre-processed Image:

Detected Trees from Test Image:

For this test image, 510 trees out of a possible 528 trees were counted and approximately located, which gives an accuracy of 96.5% with minimal false positives. The algorithm is still under development, but so far the results are promising.