Implementation of manual binarization & gradient