Problem in Calculating NDVI Values Using Multispectral Images

2 ビュー (過去 30 日間)
Thomas Taufan
Thomas Taufan 2019 年 12 月 28 日
コメント済み: kazeem 2023 年 12 月 13 日
I want to calculate NDVI values using multispectral images that range from -1 to 1 using the formula (NIR-R)/(NIR+R). NIR means the image in Near-Infrared band and R means the image in Red band. I apologize if there is any mistake and I humbly ask for guidance.
Following is the images in RGB, Red, and Near-Infrared that I have converted to jpg so I could upload it here, the original type is TIF.
Below is the code that I used to compute these images :
R = imread('RED.TIF');
NIR = imread('NIR.TIF');
NDVI = (NIR-R) ./ (NIR + R); % [In this step I couldn't use / to compute, could you tell me why?]
NDVI = double(NDVI); % [Why the variable has to be changed to double type? Because if not the image couldn't be shown.]
colormap(jet); colorbar; impixelinfo;
Why is the NDVI variable only contain 0s and 1s? As the NDVI value should be ranging from -1 to 1 and I want the value to be in 2 digits after decimal. How can I improve the image processing as the green area of plants is missing in the final results? Do I need another methods to calculate it?
Thank you for your attention, sir.
  1 件のコメント
kazeem
kazeem 2023 年 12 月 13 日
thank you, but the raster has so much misalignment. why?

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2019 年 12 月 30 日
You need to cast to double before adding, subtracting, or dividing
NDVI = (double(NIR) - double(R)) ./ (double(NIR) + double(R));
imshow(NDVI, []); % Make sure you use [] because NDVI is floating point.
  2 件のコメント
Thomas Taufan
Thomas Taufan 2019 年 12 月 30 日
It works!! Thanks for that sir
NDVI_COLORMAP.jpg
Can I determine the minimum and maximum value of the NDVI variable? How do I make a threshold for example higher or equal to 0.3 are green and lower than that are red? Can I make bounding box for the specific pixels that has low values?(but in the plant area, not the road or things that are not vegetation)
Franz Lord Memije
Franz Lord Memije 2020 年 5 月 18 日
hi. have you solved this problem already? if you may, kindly share it with me in here. thank you

サインインしてコメントする。

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by