像大多数的图片转换工具一样,C#的重绘功能也可以实现相同的效果.

Graphics g = this.CreateGraphics();
g.Clear(Color.White);
Bitmap image 
= new Bitmap("test.jpg");
int Width = image.Width - 1;
int Height = image.Height - 1;

            
//绘制原图   
g.DrawImage(image, 00);
g.TranslateTransform(image.Width, 
0);

           
/*image2、image3分别用来保存最大值法   
            和加权平均法处理的灰度图像
*/

Bitmap image2 
= image.Clone(new Rectangle(00, image.Width,image.Height),PixelFormat.DontCare);
Bitmap image3 
= image.Clone(new Rectangle(00, image.Width,image.Height),PixelFormat.DontCare);

Color color;
使用平均值进行灰度处理
  
使用最大值法进行灰度处理
 
使用加权平均法进行灰度处理
灰度的还原演示,还原使用最大值法处理的灰度图像image2
            
//重新绘制还原后的伪彩色位图   
            
//重新绘制灰度化图  
            g.DrawImage(image2, new Rectangle(00, Width, Height));

posted on 2007-12-18 14:27 西门潇洒 阅读(276) 评论(0)  编辑 收藏 所属分类: WinForm程序开发

标题  
姓名  
主页
Email (博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
"五向定位"职业成长路线公开课(上海、南京、大连)
Google站内搜索


相关链接: