# How to amplify regions with specific color in an image?

I want to amplify regions with a specified color in an image. For this purpose I have defined a simple function

$B(x,y)=s_r(x,y) \cdot w_r + s_g(x,y) \cdot w_g + s_b(x,y) \cdot w_b$

which produces a gray scale image B(x,y).

The weights I have defined with

$w_r \in [-2,2],w_g \in [-2,2], w_b \in [-2,2]$

The channels of the images are the functions $s_x$ for each channel. I use the result of this amplification for a color thresholding. For example for yellow I have manually defined $w_r=1$, $w_g=1$ and $w_b = -2$. My Problem now is, to get "good" values for the weights automatically. First I thought taking the maximal values of histograms would be a good way, but the results are not satisfactorily.

How can I automatically determine the weights for the amplification?

How would you deal with white and black?

Or is there a better way to amplify the regions with a specific color?

• Why don't try working in HSB ... seems much easier Jan 17 '12 at 4:29
• Do you want to amplify regions matching exactly a color or do you want to make a more or less smooth amplification include colors close to your chosen one? Jan 17 '12 at 14:30
• The second, I want to amplify a color range. Jan 20 '12 at 13:36
• @martin, I would like to attenuate regions matching exactly a "True" RGB color where I know the bounding box x and y coordinates. How might I do that? Feb 14 '16 at 8:32