Binarization of image for varying background and foreground colors for OCR
This problem is well studied. It is termed scene text recognition. Of course, the state-of-the-art methods involve deep learning. In particular, I like the works, which use a bi-directional LSTM together with features extracted from Convolutional Neural Networks. This allows for end-to-end training and frees the segmentation or binarization requirement. In particular, I like the work:


  Reading Scene Text in Deep Convolutional Sequences - 
  Pan He, Weilin Huang, Yu Qiao1, Chen Change Loy2, Xiaoou Tang2
  AAAI 2016