Here i am trying to calculate ndvi index.
but in python if i read the image get band than after try to perform ndvi index it will give me numpy array.
so how to calculate ndvi index range between -1 to 1 ?
Thanks for your support.
In this we have refer below link for ndvi calculation.
So basiclly my code look like this in (Python Language)
re_img1 = cv2.imread(filename)
B, G, R = cv2.split(re_img1)
divisor = (R.astype(float) + B.astype(float))
divisor[divisor == 0] = 0.01 # Make sure we don't divide by zero!
ndvi = ((R.astype(float) - B.astype(float)) / divisor) + (1/3)
print('NDVI INDEX',round(ndvi.max(),2))//NDVI INDEX MAX -1 to 1
So see the image With diffrent formula and same image.
So ndvi index must be (-1 to 1 ) between but in this i am getting max index from numpy array so index like (1.33,1.13,etc).
Is there any tool for ndvi index calculation.
Is this a question? Click here to post it to the Questions page.