What I want to do
I'm using a PiNoir camera with a blue filter to take ngb pictures. As I need to do a color balance before turning the picture to ndvi (I'm not using awb_gains) I created a matlab routine to do this adjustment automatically.
Since I take the pictures with a piece of blue paper, that is my calibration parameter, I insert the location of the blue pixel and it adjusts the red and blue channels until it becomes gray. In the same code, after doing the color balance, matlab turns the photo in ndvi. I've been using vgyrm gradient.
My attempt and results
I think that the conversion to ndvi is correct. I compared the results with Fiji's. Some results and foliage related histograms are shown below.
Questions and next steps
The problem is that I'm not sure if I'm doing color balance correctly in the pictures and if is it possible to increase these results somehow...
For the same plant, the results were very different. Some areas are magenta colored and I think that the leaves doesn't show high ndvi values (>0.9) so I guess that's ok. But some other areas (not foliage) showed values between 0.2 and 0.9 and I don't know why, since there is no photosynthesis occuring there.
Please could you guys confirm if those results are correct and, if not, what can I do to try to correct them?