#πŸ”’ NDVI With Python

36 messages Β· Page 1 of 1 (latest)

sharp hamlet
#

Hi i am currently learning python and would like to use it to analyse images from my multispectral camera and turn the into NDVI maps. Does anyone know some books or courses that could help me learn this field using python.
Thanks

real dockBOT
#

@sharp hamlet

Python help channel opened

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.

tiny dirge
#

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?

sharp hamlet
#

Hi so my red band is 620-670nm and the NIR band is 840-880nm.

tiny dirge
#

Are these bands serial on one channel?

#

Or are they on different channels?

sharp hamlet
#

They are on different channels

tiny dirge
#

Each their own?

#

What's the remaining channel?

#

Also, what is mapped to what?

sharp hamlet
#

red is mapped to channel 1 and NIR is mapped to channel 2

tiny dirge
#

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.

real dockBOT
tiny dirge
#

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.

sharp hamlet
#

ok thanks before you go may i ask how you learnt to do code related to this in python?

tiny dirge
#

Time ill spent playing with images and making the numbers go brr to achieve interesting effects.

silent sand
#

Have you asked this question yesterday as well? I remember sharing a book on this a day or two ago. Has that helped?

sharp hamlet
#

yes i have started looking at it

tiny dirge
#

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.

sharp hamlet
#

thanks

silent sand
#

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

real dockBOT
#
Python help channel closed

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.