Bandmath filter disparities cannot run in qgis

How can I fix this process?

Dear @rapeeya,

I don’t understand your question. Can you be more precise? What error do you encounter? What command did you run? How did you install OTB? Are you using Windows, Mac or Linux?

I see you are using the CookBook for the version 6.2.0 of OTB. It was released more than 4 years ago. I strongly recommend switching to more recent version. Last version is OTB 7.4.

Julien :slight_smile:

Algorithm ‘BandMath’ starting…
Input parameters:
{ ‘il’ : [‘C:/Users/location/disparity_map_ncc.tif’], ‘out’ : ‘C:/Users/location/thres_disparity.tif’, ‘exp’ : ‘im1b3>0.9 ? 255 : 0’, ‘outputpixeltype’ : 5 }

2022-02-28 23:02:57 (INFO): Loading kwl metadata from attached geom file C:/Users/location/disparity_map_ncc.geom
2022-02-28 23:02:57 (INFO) BandMath: Default RAM limit for OTB is 256 MB
2022-02-28 23:02:57 (INFO) BandMath: GDAL maximum cache size is 404 MB
2022-02-28 23:02:57 (INFO) BandMath: OTB will use at most 8 threads
2022-02-28 23:02:57 (INFO) BandMath: Image #1 has 2 components

2022-02-28 23:02:57 (INFO): Estimated memory for full processing: 452.027MB (avail.: 256 MB), optimal image partitioning: 2 blocks
2022-02-28 23:02:57 (INFO): File C:/Users/location/thres_disparity.tif will be written in 3 blocks of 4462x984 pixels
2022-02-28 23:02:57 (FATAL) BandMath: itk::ERROR: MultiThreader(00000220E45033B0): Exception occurred during SingleMethodExecute
itk::ERROR: BandMathImageFilter(00000220E6140BF0):
itk::ExceptionObject (0000005B54789368)
Location: “unknown”
File: …\Modules\Filtering\MathParser\src\otbParser.cxx
Line: 170
Description: itk::ERROR: ParserImpl(00000220E480B4B0):
Message: Unexpected token “im1b3” found at position 0.
Formula: im1b3>0.9 ? 255 : 0
Token: im1b3
Position: 0

Execution completed in 0.20 seconds
{‘out’: ‘C:/Users/location/thres_disparity.tif’}

Loading resulting layers
The following layers were not correctly generated.
• C:/Users/location/thres_disparity.tif
You can check the ‘Log Messages Panel’ in QGIS main window to find more information about the execution of the algorithm.

The BandMath application takes an image list as input. And each image can have multiple band. When the expression contains the variable imXbY, it refers to the Yth band of the Xth image of the input list. In your case, “im1b3” refers to the 3rd band of the first image. If this image has less than 3 band, the application returns this error. Can you check the number of band of your input image ? If it has only one band, you can use “im1b1”.

Julien :slight_smile:

thankyou so much your advice it work! :slight_smile:

Can i ask you another question please. In the last process (DisparityMapToElevationMap) of stereoscopic reconstruction there was an error.

The error message says that the two image don’t overlap. In order to generate a DEM, the two input images need to represent a common area. Can you check if this is the case?