image processing and color detection in java

I am trying to put together a project using Eclipse which will take a saved image and be able to detect certain colors. For example, if the image contained various colored circles (or any shape really) it would be able to specify the color of the circles on screen – red, yellow, pink, etc.

I’m not really sure where to begin with this so any help would be appreciated. I am still learning when it comes to java so please excuse my lack of knowledge.

I found some sample code online which was taking an image and separating the colors to red, blue and green using color.getRed(); color.getBlue(); color.getGreen(); – but i’m not quite sure how to extend this to colors such as yellow, pink, brown etc. Although the outcome I am ideally looking for is to detect colors already existing in an image rather than converting the entire image itself to a specific color.


color.getRed(); color.getBlue(); color.getGreen(); are primary colors, you can get any color combining these values.