1 | initial version |
Perform an RGB histogram calculation of your image. Look inside the R, G and B channel which two components are the largest (background and color of letters). Then combine these largest values to detect the actual color that is dominant by combining the three channels into a single color.
If it is segmentation that you want to achieve, you could also perform a RGB to grayscale conversion and then perform the histogram voting to know the two dominant grayscale values.
Not sure which functions compute the histograms of an input image, but do a search on histogram in the openCV documentation: http://docs.opencv.org/
Cheers!