直接贴代码
——————————
有更好的方法一起讨论
float[][] transArray = {
new float[] { 1, 0, 0, 0, 0 },
new float[] { 0, 1, 0, 0, 0 },
new float[] { 0, 0, 1, 0, 0 },
new float[] { 0, 0, 0, 1f, 0 },
new float[] { 0, 0, 0, 0, 1 }
};
ColorMatrix mstrix = new ColorMatrix(transArray);
ImageAttributes attri = new ImageAttributes();
attri.SetColorMatrix(mstrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
Bitmap bmp = new Bitmap(@"E:/Jiho/ll.jpg");
e.Graphics.DrawImage(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height), 0, 0, bmp.Width, bmp.Height, GraphicsUnit.Pixel, attri);
本文介绍如何利用ColorMatrix和ImageAttributes类来实现图像处理,包括颜色矩阵变换和图像属性设置,通过实例演示了如何加载图像、应用颜色变换,并在指定位置绘制处理后的图像。
1491

被折叠的 条评论
为什么被折叠?



