Julien Michel <[email protected]> wrote:
> 2) Regarding your second question, it depends on what you intent to calculate 
> : the mean and std dev of one layer,
> or the mean and std dev of one pixel accross several layers ? The latter is 
> already possible (you just need to
> write the mathematical expression), while the former again requires more code 
> on OTB side (but it would be useful
> to be able to call std(im1b1) for instance in a formula).

Julien,

The former (mean or stdv of each band is already available using the 
ComputeImageStatistics application, isn't it?

cdc,

Here goes an example of bash code to compute the mean of all the tif images in 
a directory:

  ╭────
  │   RESULT_IMAGE = /tmp/tmp.tif
  │   NB_IMAGES = $(ls -l $INPUT_IMAGE_DIR/*.tif | wc -l)
  │   # Create an empty image with the appropriate size
  │   otbcli_BandMath -il $INPUT_IMAGE_DIR/image_name.tif -exp "im1b1*0" -out 
$RESULT_IMAGE
  │
  │   for IMAGE in $(find $INPUT_IMAGE_DIR/ -name *.tif)
  │   do
  │       otbcli_BandMath -il $IMAGE $RESULT_IMAGE -exp "im1b1+im2b1" -out 
$RESULT_IMAGE
  │   done
  │
  │   # Divide by the number of images
  │   otbcli_BandMath -il $RESULT_IMAGE -exp "im1b1/$NB_IMAGES" -out 
$RESULT_IMAGE
  ╰────

I have not tested this code, but I hope you get the idea.  
  
Jordi

PS: One could say that OTB applications are "a powerful programming language"

  A powerful programming language is more than just a means for
instructing a computer to perform tasks.  The language also serves as a
framework within which we organize our ideas about processes.  Thus,
when we describe a language, we should pay particular attention to the
means that the language provides for combining simple ideas to form
more complex ideas.  Every powerful language has three mechanisms for
accomplishing this:

"primitive expressions"
     which represent the simplest entities the language is concerned
     with,

"means of combination"
     by which compound elements are built from simpler ones, and

"means of abstraction"
     by which compound elements can be named and manipulated as units.

     
[http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-4.html#%_toc_%_sec_1.1]

-- 
-- 
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to