I am not sure if I understood your question correctly. From what I understood, you have a color image with different regions and you want to determine the dominant color of each region? If this is correct I would suggest something like:
1) Find a feasible segmentation method.
2) Apply something like connected component labeling.
3) For each labeled region examine all pixels color values.
4) Apply some kind of voting for each region, to determine the dominant color based on the majority of the pixels. Maybe, mean or median of all color values might also be suitable.
I think Sylvio Barbon method will work. Now after the above matlab code implementation, you have three frames which are Red, Green and Blue components. Now your task is to choose you required color values of all three like (R=100-150 range, G=170-200 range and B=50-150 range, these values are just example to find the particular color). Then apply the following if condition. If this condition satisfied, then you can write the required code inside that if loop, otherwise that pixel will be skipped. Hope it will solve your problem, if not yet, i can provide you complete code for extraction of a particular range of color object.
Try the following magic equations to extract red, green, blue and yellow colored features from your image. I am assuming you are coding in matlab. Let me know if it works.
The red component (suppresses non-red colored objects) is obtained by subtracting the green channel from the red channel. If your original image has 3 channels, RGB. This can be designated as:
red=f (:,:,1)-f (:,:,2)
The green colored components are designated by:
green=2*f(:,:,2)-[1.5*f(:,:,1)+ f(:,:,3)]
The blue colored components are designated by:
b(x,y)=2*f(:,:,1)-[f (:,:,3)+ f (:,:,2)]
The yellow colored components in the image are designated by:
If you're trying to classify colors for each pixel independently all you need to do is take the three color values for each pixel (as suggested by Sylvio) and then based on those three numbers (which make up the color) you decide how close the pixel's color is to a color that you have labeled. You do this by using some sort of metric. For example, if your favorite color has the values (70,12,151), and the pixel has the values (100,31,80), you could calculate the metric as METRIC=(70-100)^2+(12-31)^2+(151-80)^2. You do this calculation for each color label you have and you choose the color that has the smallest number for the metric.