New operators and functions have been implemented within BandMathX application. These ones can be divided into two categories.
Concerning the last category, here is a list of implemented operators or functions (they are all implemented in otbParserXPlugins.h/.cxx files -OTB/Code/Common-):
Operators div and dv
The first operator allows the definition of an element-wise division of two vectors (and even
matrices), provided that they have the same dimensions. The second one allows the definition of the
division of a vector/matrix by a scalar (components are divided by the same unique value). For
instance:
![]() | (4.13) |
![]() | (4.14) |
Operators mult and mlt
These operators are the duals of the previous ones. For instance:
![]() | (4.15) |
![]() | (4.16) |
Note that the operator ’*’ could have been used instead of ’pw’ one. But ’pw’ is a little bit more permisive, and can tolerate one-dimensional vector as right element.
Operators pow and pw
The first operator allows the definition of an element-wise exponentiation of two vectors (and even
matrices), provided that they have the same dimensions. The second one allows the definition of the division
of a vector/matrix by a scalar (components are exponentiated by the same unique value). For
instance:
![]() | (4.17) |
![]() | (4.18) |
Function bands
This function allows to select specific bands from an image, and/or to rearrange them in a new vector; for
instance:
![]() | (4.19) |
produces a vector of 4 components made of band 1, band 2, band 1 and band 1 values from the first input. Note that curly brackets must be used in order to select the desired band indices.
Function dotpr
This function allows the dot product between two vectors or matrices (actually in our case, a kernel and a
neighbourhood of pixels):
![]() | (4.20) |
For instance:
![]() | (4.21) |
is correct provided that kernel1 and im1b1N3x5 have the same dimensions. The function can take as many neighbourhoods as needed in inputs.
Thus, if n neighbourhoods must be processed, the output will consist in a row vector of n values. This behaviour is typical of the functions implemented in the BandMathX application.
Function mean
This function allows to compute the mean value of a given vector or neighborhood (the function can take as
many inputs as needed; one mean value is computed per input). For instance:
![]() | (4.22) |
Note: a limitation coming from muparserX itself makes impossible to pass all those neighborhoods with a unique variable.
Function var
This function allows to compute the variance of a given vector or neighborhood (the function can take as
many inputs as needed; one var value is computed per input). For instance:
![]() | (4.23) |
Function median
This function allows to compute the median value of a given vector or neighborhood (the function can take
as many inputs as needed; one median value is computed per input). For instance:
![]() | (4.24) |
Function corr
This function allows to compute the correlation between two vectors or matrices of the same dimensions
(the function takes two inputs). For instance:
![]() | (4.25) |
Function maj
This function allows to compute the most represented element within a vector or a matrix (the
function can take as many inputs as needed; one maj element value is computed per input). For
instance:
![]() | (4.26) |
Function vmin and vmax
These functions allow to compute the min or max value of a given vector or neighborhood (only one input).
For instance:
![]() | (4.27) |
Function cat
This function allows to concatenate the results of several expressions into a multidimensional vector,
whatever their respective dimensions (the function can take as many inputs as needed). For
instance:
![]() | (4.28) |
Note: the user should prefer the use of semi-colons (;) when setting expressions, instead of directly use this function. The application will call the function ’cat’ automatically.
Function ndvi
This function implements the classical normalized difference vegetation index; it tkaes two inputs. For
instance:
![]() | (4.29) |
First argument is related to the visible red band, and the second one to the near-infrareds band.
The table below summarises the different functions and operators.
Variables | Remark |
ndvi | two inputs |
bands | two inputs; length of second vector input gives the dimension of the output |
dotptr | many inputs |
cat | many inputs |
mean | many inputs |
var | many inputs |
median | many inputs |
maj | many inputs |
corr | two inputs |
div and dv | operators |
mult and mlt | operators |
pow and pw | operators |
vnorm | adapation of an existing function to vectors : one input |
vabs | adapation of an existing function to vectors : one input |
vmin | adapation of an existing function to vectors : one input |
vmax | adapation of an existing function to vectors : one input |
vcos | adapation of an existing function to vectors : one input |
vsin | adapation of an existing function to vectors : one input |
vtan | adapation of an existing function to vectors : one input |
vtanh | adapation of an existing function to vectors : one input |
vsinh | adapation of an existing function to vectors : one input |
vcosh | adapation of an existing function to vectors : one input |
vlog | adapation of an existing function to vectors : one input |
vlog10 | adapation of an existing function to vectors : one input |
vexp | adapation of an existing function to vectors : one input |
vsqrt | adapation of an existing function to vectors : one input |