I've tested about these images, and it was working well about first image which has light background and dark letters.
Second image is color-inverted one for the first image, but I couldn't get unexpected result.
I think it's a problem occurred due to image pre-processing step.