Analyze color scheme of images, and need to take the average of hue. The problem is that hue is looped: after 359° should be zero.

In this situation, take the average of n? Consider that n is large and unprofitable to store all the numbers, you need some "adder".

In this situation, take the average of n? Consider that n is large and unprofitable to store all the numbers, you need some "adder".

asked June 27th 19 at 15:36

1 answer

answered on

Solution

While the most successful method is as follows.

Go to the coordinates (x, y): x = cos(hue) · sat, y = sin(hue) · sat.

There you can get the average (x, y) and take atan2.

Go to the coordinates (x, y): x = cos(hue) · sat, y = sin(hue) · sat.

There you can get the average (x, y) and take atan2.

Find more questions by tags Algorithmsimage processingMathematicsWork with color