Band Math Expression failing in 'Stereo pair' tutorial

Hello all,

I’m following the tutorial in -
to get an elevation map from stereo pair.

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

After reading this post:

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:

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


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”).


Bingo - works a treat, stupid typo!!

Thanks so much cedric