Implement paper beautifier via adaptive thresholding