The function SumArrayMasked calculates the sum of all values of the cells of the matrix Mat which are not masked by the corresponding MaskArray cell and returns the sum in the variable parameter Sum. A TRUE value in a cell of MaskArray masks this cell. The function value returns the number of processed pixels.
The function returns the following error codes:
≥0 ... everything is ok
-1 ... the sizes of Mat and MaskArray do not match
-2 ... Mat has no size at all