Binarization

binarize(M, thresh) Returns a binarized version of matrix M with pixels above threshold thresh set to 1 and below to 0.

binarize2(M, lowThresh, highThresh, inValue, outValue) Returns a binarized version of matrix M with pixels between lowThresh and highThresh set to inValue, and pixels outside to outValue.

binarize_auto(M) Returns a binarized version of matrix M, choosing the threshold automatically.

Arguments: