Clear Filters
Clear Filters

how do we calculate vegetation using ndvi------can u plz provide me with the code

1 view (last 30 days)
ndvi
  3 Comments

Sign in to comment.

Answers (2)

Cyrus
Cyrus on 25 Dec 2016
Edited: Cyrus on 25 Dec 2016
if it is landsat8 image:
Formula: NDVI = (NIR -R) / (NIR + R)
File_Path = 'path\'; %%keep the \
File_Name = 'LC80292015263LGN00_B';
Band_Number = '3';
Full_File_Name = strcat(File_Path, File_Name, Band_Number, '.TIF');
[G, ~] = geotiffread(Full_File_Name);
clearvars Band_Number Full_File_Name
Band_Number = '4';
Full_File_Name = strcat(File_Path, File_Name, Band_Number, '.TIF');
[R, ~] = geotiffread(Full_File_Name);
clearvars Band_Number Full_File_Name
Band_Number = '5';
Full_File_Name = strcat(File_Path, File_Name, Band_Number, '.TIF');
[NIR, ~] = geotiffread(Full_File_Name);
clearvars File_Path File_Name Band_Number Full_File_Name
G_heq = histeq(G);
R_heq = histeq(R);
NIR_heq = histeq(NIR);
NIR = double(NIR_heq);
R = double(R_heq);
G = double(G_heq);
NDVI = (NIR -R) ./ (NIR + R);
figure(), imshow(NDVI, []), title('NDVI');
colormap(jet);
colorbar;
impixelinfo

sajeela khan
sajeela khan on 27 Jan 2018
how can we find the NDVI using miltispectral image
  1 Comment
Amit Bhasin
Amit Bhasin on 20 Feb 2019
Hey Cyrus,
Thank for the answer. What if I have images collected (multispecratl images; 5 bands; R,G,B, NIR, Red-edge) from a drone?
Thanks

Sign in to comment.

Categories

Find more on Biomedical Imaging 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!