get average color from bmp

后端 未结 1 488
春和景丽
春和景丽 2021-02-08 09:13

I am developing a taskbar for the 2nd screen(something like displayfusion).

However, I\'m having difficulty at getting the right average color from the icon. For exampl

1条回答
  •  孤城傲影
    2021-02-08 09:20

    The average color is not neccessarily the color most used. I recommend calculating the HUE of pixels which have saturation over a certain threshold, and use an array to create a histogram of the image. (How many times a certain hue value was used).

    Then smooth the histogram (calculate local average values with both neighbours), then get the place where this smoothed histogram takes the maximal value.

    You can get HSL values with:

    Color.GetHue
    Color.GetSaturation
    Color.GetBrightness
    

    0 讨论(0)
提交回复
热议问题