You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Good catch! You're right, our NDVI calculation is definitely wrong. The only reason we didn't notice this in our tutorials is that we're reversing the colormap to get the results we expect. I'll fix this ASAP and it will be included in the next bugfix release.
P.S. NDVI can be negative, this is often the case over water bodies. But you're probably seeing the reverse where NDVI is only positive over water bodies, which is definitely incorrect.
Description
Hi,
I had negative NDVI values therefore I was checking the code for indices calculation and found a small issue:
According to https://github.com/microsoft/torchgeo/blob/main/torchgeo/transforms/indices.py
you calculate the NDVI by using the following formula:
\text{NDVI} = \frac{\text{R} - \text{NIR}}{\text{R} + \text{NIR}}
which is the negative of NDVI, right? The common NDVI formula is: ( NIR -RED )/ (Red+NIR)
Is it a bug or did I miss anything?
Steps to reproduce
I just did code analysis.
Version
commit 35fb022 on Jul 11
The text was updated successfully, but these errors were encountered: