最常见的颜色以位图(数据) [英] Most common color in bitmap(data)

查看:157
本文介绍了最常见的颜色以位图(数据)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以提取位图的最常用的颜色。我的第一个想法是通过使用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.

推荐答案

的<一个href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/BitmapData.html#histogram%28%29"相对=nofollow>直方图()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

这篇关于最常见的颜色以位图(数据)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆