惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

U
Unit 42
罗磊的独立博客
博客园 - 聂微东
T
The Blog of Author Tim Ferriss
博客园 - 司徒正美
Stack Overflow Blog
Stack Overflow Blog
F
Fortinet All Blogs
A
About on SuperTechFans
腾讯CDC
Apple Machine Learning Research
Apple Machine Learning Research
B
Blog RSS Feed
IT之家
IT之家
V
Visual Studio Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
宝玉的分享
宝玉的分享
C
Check Point Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Vercel News
Vercel News
爱范儿
爱范儿
Microsoft Security Blog
Microsoft Security Blog
月光博客
月光博客
T
Tailwind CSS Blog
The Cloudflare Blog
Hugging Face - Blog
Hugging Face - Blog

博客园 - 韦忠波

图片旋转起来,哈哈 javascript怎么可以判断单选复选按钮是否选中,且传值 - 韦忠波 - 博客园 百度排名显示规则 让你的排名靠前 必看 QQ,MSN,SKYPE等在线状态代码 (转) 网页制作学习:meta标签之详解 - 韦忠波 - 博客园 自动跳转研究大全 - 韦忠波 - 博客园 不能使用";文件已在使用中 - 韦忠波 - 博客园 在Access中SQL的调试 无法在Web服务器上启动调试。调试失败,因为没有启用集成Windows身份认证。 visual studio.net已检测到指定的web服务器运行的不是asp.net1.1版。无法运行asp.net web应用程序,打开aspx页面时出现下载情况 .NET智能感知的快捷键 VC++小小绘图程序 一个简单的折叠打开的例子! 使用IIS配置OTA下载手机程序 IIS配置OTA(摘取) 手机上网相关问题 OTA配置服务器 Apache下 配置WAP + OTA方法 如何解决ADO.NET访问Access数据库出现"操作必须使用一个可更新的查询"的问题
图像处理之入门篇
韦忠波 · 2006-07-17 · via 博客园 - 韦忠波

图像处理之入门篇

Posted on 2006-07-17 12:33  韦忠波  阅读(309)  评论()    收藏  举报

先看效果:

处理后:

代码如下:
Color c1=new Color();
       Color c2=new Color();
      Color  c3=new Color();
   Color c4=new Color();
   int rr,gg,bb,r1,r2,r3,r4,fxr,fyr,i,j;
   int g1,g2,g3,g4,fxg,fyg,b1,b2,b3,b4,fxb,fyb;
   Bitmap box1=new Bitmap(openImage.Image);
   for(i=0;i<openImage.Image.Width-2;i++)
   {
    for(j=0;j<openImage.Image.Height-2;j++)
    {
     c1=box1.GetPixel(i,j);
     c2=box1.GetPixel(i+1,j+1);
     c3=box1.GetPixel(i+1,j);
     c4=box1.GetPixel(i,j+1);
     r1=c1.R;
     r2=c2.R;
     r3=c3.R;
     r4=c4.R;
     fxr=r1-r2;
     fyr=r3-r4;
     rr=Math.Abs(fxr)+Math.Abs(fyr)+128;
     if(rr<0)rr=0;
     if(rr>255)rr=255;
     g1=c1.G;
     g2=c2.G;
     g3=c3.G;
     g4=c4.G;
     fxg=g1-g2;
     fyg=g3-g4;
     gg=Math.Abs(fxg)+Math.Abs(fyg)+128;
     if(gg<0)gg=0;
     if(gg>255)gg=255;
     b1=c1.B;
     b2=c2.B;
     b3=c3.B;
     b4=c4.B;
     fxb=b1-b2;
     fyb=b3-b4;
     bb=Math.Abs(fxb)+Math.Abs(fyb)+128;
     if(bb<0)bb=0;
     if(bb>255)bb=255;
     Color cc=Color.FromArgb(rr,gg,bb);//由颜色分量值创建Color结构
     box1.SetPixel(i,j,cc);
     openImage.Refresh();
     openImage.Image=box1;