在.NET彩色图像量化图像、彩色、NET

2023-09-03 06:27:24 作者:我的小熊

我希望减少在C#的位图的唯一的颜色数量。

I want to reduce the number of unique colors of a bitmap in c#.

我想这样做的原因是,它最初有三个颜色,但由于多种因素(包括COM pression)创建的映像现在已经超过三种颜色(即相邻像素已经影响到对方)

The reason I want to do this is that an image which is initially created with three color but due to many factors (including compression) has now more than three colors (i.e neighbour pixels has affected each other)

怎么做,你知道吗?

将溶液说不定东西整个位图从RGB转换为索引颜色系统或者能够应用于单个像素一些功能

The solution maybe something to convert the whole bitmap from RGB to Indexed color system or some function that can be applied to a single pixel.

任何GDI +或Emgu(OpenCV的)解决方案是为我好。

Any GDI+ or Emgu (opencv) solutions are good for me.

推荐答案

查看nQuant在的http:// nquant 。codeplex.com 。这将产生质量比code MSDN文章说马格努斯引用高得多。它还采用了阿尔法层考虑,而MSDN文章只判断RGB。来源$ C ​​$ c是可用,还有一个附带的博客文章,讨论了code和算法的细节。

Check out nQuant at http://nquant.codeplex.com. This yields much higher quality than the code in the MSDN article that Magnus references. It also takes the Alpha layer into consideration while the msdn article only evaluates RGB. Source code is available and there is an accompanying blog post that discusses the code and algorithm in detail.