Question: NDVI in realtime video

andresc4 is asking a question about ndvi
Follow this topic

by andresc4 | February 24, 2015 16:37 | #11633


What I want to Do:

Hi, I want to get a NDVI video in realtime from a UAV, either by using a small Pcduino+linux software + and 2 webcams + composite video out + vtx
or by using 2 cameras and 2 vtx , 2 rx and 2 capure cards on the ground.

What I did already:

At the moment what I did is the software ( shader ) that does the math computing on the GPU using VVVV.... I did it with help of a friend caller "colorsound" on the vvvv forums, he is a real genius :). We were able to do it realtime with pictures (jpeg files ) and we were able to change values in realtime and it worked just fine, at this point it was the same as doing it with photoshop, We need to manualy align the pictures,,, that something that we miss from Fiji.

I realised that using 2 cameras will be too much for a small hexacopter, so we want to move to the 1 camera option, and here is my problem... I cant get it to work with 1 camera. At the momento we have 2 canon a2300 , one with Ir filter another one without Ir filter

We have a Wratten 25A Red filter, a Rosco 2007 Blue Filter, and a KenkoS054.2 58Ya2 Yellow Filter... with 2 cameras we were using the Rosco2007 and the RGB camera + Fiji.

We also have some pictures from a Runco x100 that is carring with Ricoh modiffied camera without IR filter + Yellow filter ( thats a 25.000USS uav ). I want to get the same result on my canon camera without ir + yellow filter. With that picture from that camera, my new code is working. The shader looks like this

float4 PS1(vs2ps In): COLOR { float4 ndiv = tex2D(Samp, In.TexCd); ndiv=( (ndiv.b-ndiv.r)/(ndiv.b+ndiv.r) * contraste) + brillo ; return ndiv; }

Where ndvi.b is the blue chanel, ndvi.r is the red chanel , and "contraste" and "brillo" are 2 external values that I can change at any point, basicaly is contrast and brigthnes... at any given picture, I can change those values to get the best (grayscale) output,,, and once i have that output i run nother shader that multiply each pixel value to a color, so i can get any lua table that we are used to.

This is working just fine with that picture, and If i do the same with a webcam it will work also

Examples and files:

Here I leave an example of the proceses

https://www.dropbox.com/s/h3oc99jxww10ztx/uploaddd.jpg?dl=0

And here there is a folder with 4 pictures taken with each of the 3 filters that I have, and each of them in the 4 white balance modes of my camera, total 12 pictures, https://www.dropbox.com/sh/2w1z0t76utipyo4/AABMn6iJoNMCTsw8LXTaNw9oa?dl=0

What I need to continue:

What I need is to know with aproach is the best for 1 camera only,,, and what is the formula for the NDVI with one camera. At this point I'm verry confused and any help will be wellcome



8 Comments

One way to do this could involve the python version of infragram -- perhaps modded to use Infragrammar?

Is this a question? Click here to post it to the Questions page.

Reply to this comment...


Another thing that confuses me a little bit more is this response from the people of Pix4d

Pix4D Support December 01, 2014 13:28 Dear Andres,

We have checked the camera and filters you refer to and it seems that they are not adequate for NDVI. For NDVI the Red and Infra-Red bands are needed.

So, if you remove the IR filter from your camera, then you let IR wavelength light in the camera. However, IR and Red are captured in one Band and, so it is not possible to calculate NDVI.

Moreover, if you add the Wratten 24A RED, then you discard the Red values and if you add the Blue Rosco 2007, you get the IR but not the Red.

So, these filters are not adequate for your needs.

Reply to this comment...


The response from Pix4D does not seem to be well informed. With a Wratten 25A filter, NIR and little else will be captured in the blue channel and the red channel will have lots of red plus some NIR. So NDVI would use the red channel for red and the blue channel for NIR. With a blue Rosco 2007 filter, NIR and some red are captured in the red channel and blue and some NIR are captured in the blue channel. So NDVI would use the blue channel for visible light and the red channel for NIR. Red filters seem to work better than blue on CMOS cameras. Yellow filters would use the same channels as red filters for NDVI. The channels are less contaminated in two-camera systems, but results can be good in single-camera systems.

Chris

Reply to this comment...


cfastie Great, in that case the formula that I'm using is correct for the Weatten25A or for the Yellow filter

ndiv= (ndiv.b-ndiv.r)/(ndiv.b+ndiv.r)

But what about the white balance ? how should I do it with the A2300 ? I just tested the 4 different pre seted white balances and I did a white balance with the Red filter over a white paper... It should be a red paper ?

Here are the 4 results of the pictures and a RGB picture https://www.dropbox.com/sh/93xt24l84iv3i2q/AABZu43vPB5NokV_G1ofuxHta?dl=0

I don't seem to find any good result,,,

EDIT

Well, this is something... this is the last image, the one i did a white balance over a white paper

http://imageshack.com/a/img538/6663/oLpWQi.jpg http://imageshack.com/a/img908/1336/iUFCal.jpg http://imageshack.com/a/img673/8836/kiQCrf.jpg

Is this a question? Click here to post it to the Questions page.

Reply to this comment...


Andresc4, The A2300 allows custom white balance. For a red or yellow filter, flood the sensor with red light (fill the frame with red paper in direct sunlight) while pressing the button for custom white balance. Using that setting for photos exaggerates the values in the blue channel (NIR) and the NDVI values for some foliage come out close to real ones. Chris

Reply to this comment...


Note: the python library is here: https://github.com/publiclab/infrapix

Infragrammar would be great to adopt as a standard: http://publiclab.org/wiki/infragram-sandbox

Reply to this comment...


Hi Andresc4, i would like be in touch with you.i'm researching about the same like you. I live in Argentina. Please contact me my emailagustin.castel@gmail.com or mobil 3813041826. Saludos

Reply to this comment...


Hey, interesting. I am also from Argentina and I am working in the same field. Can you write me? ignacio.rigoni at gmail. Abrazo!

Is this a question? Click here to post it to the Questions page.

Reply to this comment...


Log in to comment