kakao
kakao

Reputation: 19

Get average color of a picture and compare pictures color using java

This is what I need to do: with camera, take picture of body's forearm, get average color of that picture, and then compare with available skin level (from white to black), to see what your skin color is (bright, dark ...) using Java. I'm stuck in getting the average color of a picture, or any other way to compare color of 2 pictures? Does anyone would help me out with this please

Thank you

Upvotes: 0

Views: 2669

Answers (3)

dloomb
dloomb

Reputation: 1972

I have had to do similar in the past. The most efficient way I found to do it was pass it to the GPU which is made for this sort of stuff. I took the image and scaled it down to a 1x1 image. The GPU will average the pixel colors as it shrinks the image thus the pixel color of the 1x1 image will be the whole images average pixel color. Do this twice and compare the results.

Upvotes: 1

dfb
dfb

Reputation: 13289

Heres a good start for color averaging

http://www.compuphase.com/graphic/scale3.htm

Upvotes: 0

I'm assuming you know from grade school how to take the average of a set of numbers.

A color is represented by three numbers: the RGB (red, green, blue) values. To find the average of a set of colors, just find the average of their respective red, green, and blue components.

Upvotes: 3

Related Questions