Discussion:
[otb-users] Advice on Raster algebra with OTB
Agustin Lobo
2018-11-05 17:40:53 UTC
Permalink
In order to calculate reflectance from a multi-spectral radiance image
acquired with a linear scanner, I also have a 1-row array of white
reference values,
that is:

multi-spectral image A: x rows, y cols, z bands
multi-spectral white reference image B: 1 row, y cols, z bands

I would need to divide each row of A by B.

In a simple notation:
res <- a
for(i in 1:nrow(a)){
res[i,,] <- a[i,,]*b
}

I'd like to this for relatively large images (x=969, y=640, z=224),
avoiding any loop if possible.
The most obvious strategy would be to create a b2 image by repeating the
row of b x times and then use the otb raster arithmetic for a/b2. But is there
an otb way to create such a b2? or perhaps another approach (I.e using
the BandMath tool?)
Thanks
Agus
--
--
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 otb-***@googlegroups.com
To unsubscribe from this group, send email to
otb-users+***@googlegroups.com
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 otb-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Guillaume Pasero
2018-11-08 09:38:32 UTC
Permalink
Agustin Lobo
2018-11-08 10:29:35 UTC
Permalink
This is really good advice, thanks. I'll keep the list informed.
Agus
Hi Agustin,
The BandMath tool only processes the images of equal sizes. So I would go
with creating an image with repeated lines, and I think the VRT format can
do that.
After a quick search here <https://www.gdal.org/gdal_vrttut.html>, I
- a VRT with the size of A,
- put inside a single 'SimpleSource' which is your one-line image B
- set the 'DstRect' parameter to the full dimension, it will stretch
the one-line image to fit the full image
- you tell GDAL to use nearest neighbor interpolation : <SimpleSource
resampling="nearest">
Regards,
Guillaume
In order to calculate reflectance from a multi-spectral radiance image
acquired with a linear scanner, I also have a 1-row array of white
reference values,
multi-spectral image A: x rows, y cols, z bands
multi-spectral white reference image B: 1 row, y cols, z bands
I would need to divide each row of A by B.
res <- a
for(i in 1:nrow(a)){
res[i,,] <- a[i,,]*b
}
I'd like to this for relatively large images (x=969, y=640, z=224),
avoiding any loop if possible.
The most obvious strategy would be to create a b2 image by repeating the
row of b x times and then use the otb raster arithmetic for a/b2. But is there
an otb way to create such a b2? or perhaps another approach (I.e using
the BandMath tool?)
Thanks
Agus
--
<http://www.c-s.fr> *Guillaume PASERO*
Responsable technique
*Business Unit ESPACE & GeoInformation - Département Payload Data &
Applications*
*CS SystÚmes d'Information*
Parc de la Grande Plaine - 5, Rue Brindejonc des Moulinais - BP 15872
31506 Toulouse Cedex 05 - FRANCE
--
--
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 unsubscribe from this group, send email to
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
For more options, visit https://groups.google.com/d/optout.
--
--
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 otb-***@googlegroups.com
To unsubscribe from this group, send email to
otb-users+***@googlegroups.com
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 otb-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...