C++ code for document image binarization