最常见的颜色以位图(数据)位图、最常见、颜色、数据

2023-09-09 21:55:18 作者:我爱他。

我想以提取位图的最常用的颜色。我的第一个想法是通过使用BitmapData循环和提取的每一个像素的颜色,并将其存储在一个数组来做到这一点。

I would like to extract the most common color of a bitmap. My first idea was to do this by looping through the bitmapData and extracting every pixel color and storing it in an array.

但功能必须尽可能轻,所以我的问题是,有没有更轻量级的方法来实现这一目标?

But the function has to be as light as possible so my question is; Is there a more lightweight approach to achieve this?

的函数被用于提取一个位图的背景颜色。

The function is used to extract background color of a Bitmap.

推荐答案

的直方图()BitmapData类的功能可以用于此。检查出的http://cc.mcgarrybowen.com/labs/2011/02/tip-use-as3s-histogram-method-for-color-averaging/它后面的信息

The histogram() function of the BitmapData class can be used for this. Check out http://cc.mcgarrybowen.com/labs/2011/02/tip-use-as3s-histogram-method-for-color-averaging/ for the info behind it

 
精彩推荐
图片推荐