#π NDVI With Python
36 messages Β· Page 1 of 1 (latest)
@sharp hamlet
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Did you end up finding out about the specifics of the spectral ranges as they apply to the recorded data and/or the model of camera being used to create the images?
Hi so my red band is 620-670nm and the NIR band is 840-880nm.
They are on different channels
red is mapped to channel 1 and NIR is mapped to channel 2
Which is all you need for the function. Hm.
If I'm reading this thing right.
!e ```py
import numpy as np
arr = np.arange(27).reshape(3,3,3)
nir = arr[..., 0]
red = arr[..., 1]
result = (nir - red) / (nir + red)
print(result)```Now I'm wondering if there needs to be some normalisation of the red and nir channels to each other first, before result is calculated, so that they lay on the same scale before being fed into the equation.
:white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | [[-1. -0.14285714 -0.07692308]
002 | [-0.05263158 -0.04 -0.03225806]
003 | [-0.02702703 -0.02325581 -0.02040816]]
This would mean talking to someone with an actual understanding of the math involved as it applies to the relative spectrality of this problem.
Or this might be the solution as is. I don't know.
Oh, I messed up the channel specifications for nir and red. Nevermind.
The idea would be to get the numbers after the ellipses right.
I hope we're getting you closer.
I'm off for now.
ok thanks before you go may i ask how you learnt to do code related to this in python?
Time ill spent playing with images and making the numbers go brr to achieve interesting effects.
Have you asked this question yesterday as well? I remember sharing a book on this a day or two ago. Has that helped?
yes i have started looking at it
They say that Pillow is used for image manipulation, and they're not wrong, but Numpy is where it's really at.
I'm off.
Good luck.
thanks
except for geospatial data there is a specialised library in python called rasterio
@sharp hamlet when you say the images are done on your multispectral camera, is this something you're attached to a balloon and taken pictures that way or what did you do? normally for NDVI data you would use satellite images, wouldn't you?
because if you have images from satellites, there is a coefficient you need to multiply your images by to get images you can actually work with
this is called TOA coefficient
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.