# How to calculate NDI Index

3 views (last 30 days)
MaxM on 19 May 2021
Commented: Stephan on 20 May 2021
Hello,
I have to calculate the NDI (Normalized difference index) according to the formula: NDI = 128*(((G-R)/(G+R))+1)
This index is applied to all pixels of the image, giving values between 1 and +1, but to display the image, these values must be between 0 and 255.
Can someone please explain and help me how to do this?
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

### Answers (1)

Stephan on 19 May 2021
Edited: Stephan on 19 May 2021
NDI_new = uint8(rescale(NDI, 0, 255));
##### 2 CommentsShow NoneHide None
MaxM on 19 May 2021
Thank you for your answer about the rescale. First, how can I calculate the NDI for each pixel of my image ?
Stephan on 20 May 2021
What are G and R - green and red values? Or what is meant?

Sign in to comment.

### Categories

Find more on Images in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!