Ignore low chroma colors when calculating a hue's population
We rank/score colors for suitability for theming choices, and the top 4 are presented to the user. The score has two components: the chroma, or colorfulness, of the color, and the hue population of the color — what percentage of the image has hues within 15 degrees of the color. A wallpaper that is mostly black, green leaves, and a light dash of low chroma red on a couple leaves, ends up ranking red as the highest choice because black has a red hue. Ignoring low chroma colors when calculating the hue population avoids this issue — the dash of low chroma reds no longer benefits from their hue being close to black, the majority of the image. Bug: 201980078 Test: Push wallpaper from bug comment #4 to device, check color options. Red is no longer offered as an option. To come: apply to Monet Studio, verify no ill effects Change-Id: Ib40a6646077e07c2cc85da339186d9a307709def
This commit is contained in:
@@ -249,6 +249,9 @@ public class ColorScheme(@ColorInt seed: Int, val darkTheme: Boolean) {
|
||||
val population = populationByColor[entry.key]!!
|
||||
val cam = camByColor[entry.key]!!
|
||||
val hue = cam.hue.roundToInt() % 360
|
||||
if (cam.chroma <= MIN_CHROMA) {
|
||||
continue
|
||||
}
|
||||
huePopulation[hue] = huePopulation[hue] + population
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user