David,In my opinion, you have to convert background color to White and Foreground color to Black for best detection. I am doing similar kind of project and this combination gives the best result. You have to convert the color by using opencv easily... One more important think is that, if the image size is small then you have to magnified image (twice recommended) for better result.