ColorMatrix (图像小学...)
来源:互联网 发布:python 5分钟执行一次 编辑:程序博客网 时间:2024/04/30 04:05
What Is a Color Matrix?
Just as the co-ordinates x, y, and z define a single point in 3D space, the three color components R (red), G (green), and B (blue) define a single point incolor space. In 3D geometrics (and in 2D geometrics as well), matrices can be used to transform the position of a point, and, more imp
(图片来源:www.couleur.org)
A color matrix works the same way in color space. With a color matrix, you can change on
For technical reasons, points in 3D space are transformed with 4x4 matrices. A color in RGB color space can also be transformed with a 4x4 matrix. But as GDI+ works with a fourth 'color', A (alpha, or opacity) throughout, ColorMatrix is defined as a 5x5 matrix of REALs: typedef struct { REAL m[5][5]; } ColorMatrix;
GDI+ 提供用于存储和操作图像的 Image 和 Bitmap 类。Image 和 Bitmap 对象将每个像素的颜色都存储为 32 位的数:红色、绿色、蓝色和 alpha 各占 8 位。这四个分量的值都是 0 到 255,其中 0 表示没有亮度,255 表示最大亮度。alpha 分量指定颜色的透明度:0 表示完全透明,255 表示完全不透明。
颜色矢量采用 4 元组形式(红色、绿色、蓝色、alpha)。例如,颜色矢量 (0, 255, 0, 255) 表示一种没有红色和蓝色但绿色达到最大亮度的不透明颜色。
表示颜色的另一种惯例是用数字 1 表示亮度达到最大。使用这种惯例,上一段中描述的颜色将用 (0, 1, 0, 1) 表示。GDI+ 在进行颜色变换时使用以 1 表示最大亮度的惯例。
可通过用 4×4 矩阵乘以这些颜色矢量将线性变换(旋转和缩放等)应用到颜色矢量中。但是,您不能使用 4×4 矩阵进行平移(非线性)。如果在每个颜色矢量中再添加一个虚拟的第 5 坐标(例如,数字 1),则可使用 5×5 矩阵应用任何组合形式的线性变换和平移。由线性变换组成的后跟平移的变换称为仿射变换。
一言而蔽之,ColorMatrix是通过5 * 5矩阵对图像颜色(包括Alpha)进行的几何变换,理解和掌握ColorMatrix变换,能使你的图像产生千变万化的效果。
.NET中有个tem.Drawing.Imaging.ColorMatrix类,专门处理ColorMatrix相关的工作。MSDN对其解释为“定义包含 RGBA 空间坐标的 5 x 5 矩阵。ImageAttributes 类的若干方法通过使用颜色矩阵调整图像颜色”,“矩阵系数组成一个 5 x 5 的线性转换,用于转换 ARGB 单色值。例如,ARGB 向量表示为 Alpha、Red(红色)、Green(绿色)、Blue(蓝色)和 W,此处 W 始终为 1”。
具体的应用可以参考MSDN中对图像重新着色的相关文章:
如何:使用颜色矩阵对单色进行变换
讨论使用颜色矩阵变换颜色。
如何:转换图像颜色演示如何使用颜色矩阵转换颜色。
使用转换来调整颜色解释如何使用颜色矩阵调整颜色。
如何:旋转颜色描述如何使用颜色矩阵旋转颜色。
如何:修剪颜色定义剪切并解释如何使用颜色矩阵剪切颜色。
如何:使用颜色重新映射表定义重新映射并演示如何使用颜色重新映射表。
参考:
《对图像重新着色》
《颜色调整矩阵ColorMatrix详解》
《GDI+ ColorMatrix的完全揭秘》
《ColorMatrix的含义》
《Playing with ColorMatrix》
《ColorMatrix Basics - Simple Image Color Adjustment》
《Color Transformations and the Color Matrix》
《Using ColorMatrix for Creating Negative Image》
《Color Spaces》- ColorMatrix (图像小学...)
- 图像颜色处理(ColorMatrix)
- colorMatrix
- ColorMatrix
- ColorMatrix
- ColorMatrix
- Android图像处理——ColorMatrix
- C#图像处理——ColorMatrix简介
- 图像处理之矩阵变换Matrix,ColorMatrix
- JavaCV 图像修复-小学cvInpaint 算法
- GDI+ 在Delphi程序的应用 -- ColorMatrix与图像亮度
- Android学习笔记之图像颜色处理(ColorMatrix)
- Android学习笔记之图像颜色处理(ColorMatrix)
- Android学习笔记22:图像颜色处理(ColorMatrix)
- Android学习笔记22:图像颜色处理(ColorMatrix)
- Android学习笔记:图像颜色处理(ColorMatrix)
- Android学习笔记之图像颜色处理(ColorMatrix)
- android ColorMatrix常用图像颜色矩阵处理效果
- MSDN Blog:合并XAML和DirectX
- 黑马程序员-java多线程,线程同步
- EXT的自定义事件使用
- str相关的函数实现
- linux logrotate 配置及测试
- ColorMatrix (图像小学...)
- 几个容器比较容易混淆的方法(推荐)
- weka基础上 数据挖掘模型研究评估 过程
- ~~搜索!
- ArrayAdapter SimpleAdapter SimpleCursorAdapter 区别
- DLL头文件的格式和应用
- Direct3D 11 Deployment for Game Developers
- MFC为按钮添加BITMAP
- 存储管理--交换技术