Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with IndividualTreeDetection detecting trees very close together #388

Open
korotuharry opened this issue Nov 10, 2023 · 5 comments
Open
Labels
bug Something isn't working

Comments

@korotuharry
Copy link

I noticed this bug when trying to detect tree tops within the following height-normalized las file: https://drive.google.com/file/d/13wc6oy8EogL4azWHSwyU8VMDUFldfjsw/view?usp=sharing.

The following code was run using the whitebox Python package:
wbt.individual_tree_detection( i='tree_points.las', output='tree_tops.shp', min_search_radius=0.1224*2+0.3043, min_height=2, max_search_radius=0.1224*50+0.3043, max_height=50, only_use_veg=False, )

The tree top points when viewed on QGIS show two pairs of really close points near the top and top left of the plot. The points in each pair have the same height, with both pairs being around 21 m tall. At this height, with the formula used, the search radius should be 3 m but the points in each pair are about 0.3 m apart.
image

Running the equivalent process using lidR's locate_trees method, I get the same results except that there is no second point in the pairs spotted using whitebox, leading me to believe that this is a bug. A fix would be greatly appreciated!

@Izius
Copy link

Izius commented Nov 28, 2023

Hi! I am using the same tool right now. How can i come in contact with you to discuss choices of parameters and overall results. Reply would be greatly appreciated.

@korotuharry
Copy link
Author

Hi! I am using the same tool right now. How can i come in contact with you to discuss choices of parameters and overall results. Reply would be greatly appreciated.

I don't believe there's a standardized approach to choosing parameters - it's likely that the choice of window size needs to be tuned to each particular case for optimal results. Search window radius is related to crown radius in some ways so in the example I provided above, the equation I used was derived by plotting crown radius vs tree height of all trees in the Tallo database located within Canada. The results were not great though.

@Izius
Copy link

Izius commented Nov 29, 2023

Isn't your min and max search radius around 0.5 m and 5 m respectively? Maybe that's why you get two very close points (you said around 0.3 m). Maybe try plotting identified points and raw LIDAR data to see what is really going on. Today i discovered that for high trees this function is doing okay but in my case the problem is low vegetation. My LIDAR data is also not very well classified.

@Izius
Copy link

Izius commented Nov 29, 2023

To add: for higher trees I get okay identification meaning that there are no "double trees" like in your case.

@korotuharry
Copy link
Author

Have you attempted to use the data I provided? Looking at one case where I'm detecting two tree tops about 0.13 m apart both with a height of 22.87 m, I'm guessing that the reason for the doubling of tree tops is because the heights are identical. If the algorithm defines a local maximum as a point that has a height greater than or equal to the points around it, this could explain the issue. In this case, the fix could be as simple as changing the "greater than or equal" to just "greater than". I can't verify this because the code is not available though.

@Afrancioni Afrancioni added the bug Something isn't working label Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants