Band Math Expression failing in 'Stereo pair' tutorial

Hello all,

I’m following the tutorial in - https://www.orfeo-toolbox.org/packages/OTBCourses.pdf
to get an elevation map from stereo pair.

At the Band Math step I’m getting this error:
image

After reading this post:
https://otb-users.narkive.com/5Gphkw99/otb-4-2-0-error-with-otb-bandmath-unsing-expression-with-if

I assumed it was related to deprecated syntax given the comment
“they changed the if() syntax to C++ a?b:c syntax”

So switched expression to try and get it working:
image

I get the same error:
Unexpected token “if” found at position 0.

when running via shell console with command:

$ otbcli_BandMath
-il 31_disparity_map_3_1.tif
-out 31_filtered_disparity_map_3_1.tif
-exp "if(im1b3>0.9,im1b1,-1000)"

How should I structure this expression?

Using Windows 10 and OTB 6.6.1

Hello,

the correct syntax should be "im1b3 > 0.9 ? im1b1 : -1000". Can you test it like this ?

In your monteverdi example you used Im1b3 instead of im1b3 (capital “I”).

Cédric

Bingo - works a treat, stupid typo!!

Thanks so much cedric