C++ grayscale binarization source code