I need to calculate a normalized band of an RGB image given the function: (band - avg(band))/stddev(band)
The return gives values of zero. However if I use the values given by the statistics (mean and sigma) I can calculate it myself.
But for batch processing purposes I need to calculate a normalized band for every band (red green and blue).
Any ideas why this doesn’t work or what function I need to use?
ps. master student here, new to working with programs like snap.
stddev() use only the values which are passed in. The average of one value is just the value.
You can do something like avg(band_1, band_2, band_3) and this will compute the average of the three bands at the current pixel position.
All the methods in the Band Maths are pixel-based. They don’t compute values for a whole band.
If you want to do something like this you can implement an operator or use SNAP just as a library, either in Java or Python. See the Developer Guide.
oh, makes sense given the return!
Thanks for the quick reply
If you want to do something like this you can implement an operator or
use SNAP just as a library, either in Java or Python. See the Developer Guide
This is an understandable position that I can’t criticize. But I’m not a Java/Python person and the Developer Guide doesn’t seem to have the concrete examples that my gut tells me I’m looking for. If I could lay my hands on a user-implemented function (piece of XML? C source code that needs to be compiled into a lib that gets put into some directory inside my .snap directory? Something Matlab-ish?) , I imagine I could modify it to my own needs, but I can’t seem to find anything. Is there anything out there?
@tqrtuomo Maybe the snappy examples can help you. Have you seen them?
Especially the snappy_flh.py is straight forward.