Reputation: 11
I'm seeking a way to analyze different images in order to get info about whether warm or cool colors were used in them for the most part.
Something like the following and all of their shades of course.
Do you have any idea about how I can do it?
I already have a drawing program made, that looks like:
I want to analyze the paintings.
Edit: Thank you all :)
Upvotes: 1
Views: 123
Reputation: 3512
You can also write the code yourself.
I recently developed some filter for image handling and experimented with it. I wrote this snipped to count the different occurences of colors. It iterates over all pixels and returns all colors and their appearances. Key = RGB , Value = count
public static Map<Integer, Integer> getColorsFromImage(BufferedImage image){
final int widthInPx = image.getWidth();
final int heightInPx = image.getHeight();
System.out.println("Image has widht: " + widthInPx + " and height: " + heightInPx);
Map<Integer, Integer> colors = new HashMap<Integer, Integer>(); // rgb
int count = 0;
int currentColor = 0;
for(int x = 0; x < widthInPx; x++){
for(int y = 0; y < heightInPx; y++){
count = 0;
currentColor = image.getRGB(x, y);
if(colors.containsKey(currentColor)){
count = colors.get(currentColor) + 1;
}
colors.put(currentColor, count);
count = 0;
}
}
return colors;
}
Upvotes: 1
Reputation: 969
Use the official v7 palette library. The v7 palette support library includes the Palette class, which lets you extract prominent colors from an image.
You might also want to take a look at this library: Color Art
Upvotes: 1
Reputation: 15824
What you want to implement sounds somewhat familiar to a standard material design feature that is available in support libraries as well (Palette library) that can extract a number of prominent colors from bitmaps. You can have a look at these links to get started:
- http://android-developers.blogspot.ca/2014/10/implementing-material-design-in-your.html
- http://developer.android.com/training/material/drawables.html
Upvotes: 0