胖孩子
路人甲
路人甲
  • 注册日期2006-06-23
  • 发帖数18
  • QQ
  • 铜币190枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:2170回复:3

跪求数字图象处理相关程序源代码

楼主#
更多 发布于:2007-03-12 12:45
<P>听说武汉大学的复试要考上机,是关于遥感图象的平滑、滤波、直方图变换之类的。各位高手若有这方面的代码,请帮帮我吧。我的编程实在太差了。谢谢了!</P>
<P>邮箱:<a href="mailtpangjingjing123@tom.com" target="_blank" >pangjingjing123@tom.com</A></P>
<P>qq:108132888</P><img src="images/post/smile/dvbbs/em02.gif" />
喜欢0 评分0
恩恩
路人甲
路人甲
  • 注册日期2005-11-04
  • 发帖数17
  • QQ
  • 铜币78枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2007-03-13 11:30
<P>我也需要一份,哥哥姐姐们帮帮忙了,顶!</P>
<P><img src="images/post/smile/dvbbs/em08.gif" /><img src="images/post/smile/dvbbs/em01.gif" /></P>
<P><a href="mailtliuchen023@yahoo.com.cn" target="_blank" >liuchen023@yahoo.com.cn</A></P>
举报 回复(0) 喜欢(0)     评分
g7z4c3
路人甲
路人甲
  • 注册日期2006-03-30
  • 发帖数3
  • QQ
  • 铜币119枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2007-04-15 02:05
<P>using System;<BR>using System.Drawing;<BR>using System.Collections;<BR>using System.ComponentModel;<BR>using System.Windows.Forms;<BR>using System.Data;</P>
<P>namespace 滤波处理<BR>{<BR> /// <summary><BR> /// Form1 的摘要说明。<BR> /// </summary><BR> public class Form1 : System.Windows.Forms.Form<BR> {<BR>  private System.Drawing.Bitmap bmp;<BR>  private System.Windows.Forms.MainMenu mainMenu1;<BR>  private System.Windows.Forms.MenuItem menuItem1;<BR>  private System.Windows.Forms.MenuItem menuItem2;<BR>  private System.Windows.Forms.MenuItem menuItem3;<BR>  private System.Windows.Forms.MenuItem menuItem4;<BR>  private System.Windows.Forms.MenuItem menuItem5;<BR>  private System.Windows.Forms.MenuItem menuItem6;<BR>  private System.Windows.Forms.MenuItem menuItem7;<BR>  private System.Windows.Forms.PictureBox pictureBox1;<BR>  private System.Windows.Forms.PictureBox pictureBox2;<BR>  /// <summary><BR>  /// 必需的设计器变量。<BR>  /// </summary><BR>  private System.ComponentModel.Container components = null;</P>
<P>  public Form1()<BR>  {<BR>   //<BR>   // Windows 窗体设计器支持所必需的<BR>   //<BR>   InitializeComponent();</P>
<P>   //<BR>   // TOD 在 InitializeComponent 调用后添加任何构造函数代码<BR>   //<BR>  }</P>
<P>  /// <summary><BR>  /// 清理所有正在使用的资源。<BR>  /// </summary><BR>  protected override void Dispose( bool disposing )<BR>  {<BR>   if( disposing )<BR>   {<BR>    if (components != null) <BR>    {<BR>     components.Dispose();<BR>    }<BR>   }<BR>   base.Dispose( disposing );<BR>  }</P>
<P>  #region Windows 窗体设计器生成的代码<BR>  /// <summary><BR>  /// 设计器支持所需的方法 - 不要使用代码编辑器修改<BR>  /// 此方法的内容。<BR>  /// </summary><BR>  private void InitializeComponent()<BR>  {<BR>   System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));<BR>   this.mainMenu1 = new System.Windows.Forms.MainMenu();<BR>   this.menuItem1 = new System.Windows.Forms.MenuItem();<BR>   this.menuItem2 = new System.Windows.Forms.MenuItem();<BR>   this.menuItem3 = new System.Windows.Forms.MenuItem();<BR>   this.menuItem4 = new System.Windows.Forms.MenuItem();<BR>   this.menuItem5 = new System.Windows.Forms.MenuItem();<BR>   this.menuItem6 = new System.Windows.Forms.MenuItem();<BR>   this.menuItem7 = new System.Windows.Forms.MenuItem();<BR>   this.pictureBox1 = new System.Windows.Forms.PictureBox();<BR>   this.pictureBox2 = new System.Windows.Forms.PictureBox();<BR>   this.SuspendLayout();<BR>   // <BR>   // mainMenu1<BR>   // <BR>   this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {<BR>                       this.menuItem1,<BR>                       this.menuItem2,<BR>                       this.menuItem3,<BR>                       this.menuItem4,<BR>                       this.menuItem5,<BR>                       this.menuItem6,<BR>                       this.menuItem7});<BR>   // <BR>   // menuItem1<BR>   // <BR>   this.menuItem1.Index = 0;<BR>   this.menuItem1.Text = "低通滤波";<BR>   this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);<BR>   // <BR>   // menuItem2<BR>   // <BR>   this.menuItem2.Index = 1;<BR>   this.menuItem2.Text = "高通滤波";<BR>   this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);<BR>   // <BR>   // menuItem3<BR>   // <BR>   this.menuItem3.Index = 2;<BR>   this.menuItem3.Text = "水平增强";<BR>   // <BR>   // menuItem4<BR>   // <BR>   this.menuItem4.Index = 3;<BR>   this.menuItem4.Text = "垂直增强";<BR>   // <BR>   // menuItem5<BR>   // <BR>   this.menuItem5.Index = 4;<BR>   this.menuItem5.Text = "双向增强";<BR>   // <BR>   // menuItem6<BR>   // <BR>   this.menuItem6.Index = 5;<BR>   this.menuItem6.Text = "级联结构";<BR>   // <BR>   // menuItem7<BR>   // <BR>   this.menuItem7.Index = 6;<BR>   this.menuItem7.Text = "并联结构";<BR>   // <BR>   // pictureBox1<BR>   // <BR>   this.pictureBox1.BackColor = System.Drawing.SystemColors.ControlDarkDark;<BR>   this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;<BR>   this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));<BR>   this.pictureBox1.Location = new System.Drawing.Point(24, 24);<BR>   this.pictureBox1.Name = "pictureBox1";<BR>   this.pictureBox1.Size = new System.Drawing.Size(240, 240);<BR>   this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;<BR>   this.pictureBox1.TabIndex = 0;<BR>   this.pictureBox1.TabStop = false;<BR>   // <BR>   // pictureBox2<BR>   // <BR>   this.pictureBox2.BackColor = System.Drawing.SystemColors.ControlDarkDark;<BR>   this.pictureBox2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;<BR>   this.pictureBox2.Location = new System.Drawing.Point(312, 24);<BR>   this.pictureBox2.Name = "pictureBox2";<BR>   this.pictureBox2.Size = new System.Drawing.Size(240, 240);<BR>   this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;<BR>   this.pictureBox2.TabIndex = 1;<BR>   this.pictureBox2.TabStop = false;<BR>   // <BR>   // Form1<BR>   // <BR>   this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);<BR>   this.BackColor = System.Drawing.SystemColors.Highlight;<BR>   this.ClientSize = new System.Drawing.Size(576, 288);<BR>   this.Controls.Add(this.pictureBox2);<BR>   this.Controls.Add(this.pictureBox1);<BR>   this.Menu = this.mainMenu1;<BR>   this.Name = "Form1";<BR>   this.Text = "Form1";<BR>   this.ResumeLayout(false);</P>
<P>  }<BR>  #endregion</P>
<P>  /// <summary><BR>  /// 应用程序的主入口点。<BR>  /// </summary><BR>  [STAThread]<BR>  static void Main() <BR>  {<BR>   Application.Run(new Form1());<BR>  }</P>
<P>  private void menuItem1_Click(object sender, System.EventArgs e)<BR>  {<BR>   Color c =new Color();<BR>   Color cc=new Color();<BR>   Bitmap box1=new Bitmap(this.pictureBox1.Image);<BR>//   Bitmap box2=new Bitmap(this.pictureBox2.Image);</P>
<P>   int kp,kq,sr,i,j;<BR>   int n,m,sg,k1,k2,sb,ki,kj;</P>
<P>   int[,]r1=new int[300,300];<BR>   int[,]g1=new int[300,300];<BR>   int[,]b1=new int[300,300];<BR>   int[,]r2=new int[300,300];<BR>   int[,]g2=new int[300,300];<BR>   int[,]b2=new int[300,300];<BR>   float [,]h1=new float[300,300];<BR>   h1[0,0] =0.11f;h1[0,1]=0.11f;h1[0,2]=0.11f;<BR>   h1[1,0] =0.11f;h1[1,1]=0.11f;h1[1,2]=0.11f;<BR>   h1[2,0] =0.11f;h1[2,1]=0.11f;h1[2,2]=0.11f;</P>
<P>   for(i=0;i<=box1.Width-1;i++)<BR>   {<BR>    for(j=0;j<=box1.Height-1;j++)<BR>    {<BR>     c=box1.GetPixel(i,j);<BR>     r1[i,j]=c.R;<BR>     g1[i,j]=c.G;<BR>     b1[i,j]=c.B;<BR>    }<BR>   }<BR>   m=128*2;n=128*2;<BR>   for(k1=1;k1<box1.Width-1;k1++)<BR>   {<BR>    for(k2=1;k2<box1.Height-1;k2++)<BR>    {<BR>     sr=0;sg=0;sb=0;<BR>     for(i=0;i<=2;i++)<BR>     {<BR>      for(j=0;j<=2;j++)<BR>      {<BR>       ki=k1-i;kj=k2-j;</P>
<P>       if((ki>=0);(ki<m);(kj>=0);(kj<n))<BR>       {<BR>        sr=sr+(int)(r1[ki,kj]*h1[i,j]);<BR>        sg=sg+(int)(g1[ki,kj]*h1[i,j]);<BR>        sb=sb+(int)(b1[ki,kj]*h1[i,j]);<BR>       }<BR>      }<BR>     }<BR>     kp =k1-1;<BR>     kq =k2-1;<BR>     r2[kp,kq]=sr;<BR>     g2[kp,kq]=sg;<BR>     b2[kp,kq]=sb;<BR>     Color c1=Color.FromArgb(r2[kp,kq],g2[kp,kq],b2[kp,kq]);<BR>     box1.SetPixel(k1,k2,c1);<BR>    }<BR>    pictureBox2.Refresh();<BR>    pictureBox2.Image=box1;<BR>   }</P>
<P>   <BR>  }</P>
<P>  private void menuItem2_Click(object sender, System.EventArgs e)<BR>  {<BR>   Color c=new Color();<BR>//   Color cc=new Color();<BR>   Bitmap box1=new Bitmap(this.pictureBox1.Image);<BR>//   Bitmap box2=new Bitmap(this.pictureBox2.Image);<BR>   int kp,kq,sr,i,j;<BR>   int m,n,sg,k1,k2,sb,ki,kj;<BR>   int[,]r1=new int[300,300];<BR>   int[,]g1=new int[300,300];<BR>   int[,]b1=new int[300,300];<BR>   int[,]r2=new int[300,300];<BR>   int[,]g2=new int[300,300];<BR>   int[,]b2=new int[300,300];<BR>   int[,]h1=new int[30,30];</P>
<P>   h1[0,0]=0;h1[0,1]=-1;h1[0,2]=0;<BR>   h1[1,0]=-1;h1[1,1]=5;h1[1,2]=-1;<BR>   h1[2,0]=0;h1[2,1]=-1;h1[2,2]=0;</P>
<P>   for(i=0;i<=127*2;i++)<BR>   {<BR>    for(j=0;j<=127*2;j++)<BR>    {<BR>     c=box1.GetPixel(i,j);<BR>     r1[i,j]=c.R;<BR>     g1[i,j]=c.G;<BR>     b1[i,j]=c.B;<BR>    }<BR>   }<BR>   m=128*2;n=128*2;<BR>   for(k1=1;k1<=m-1;k1++)<BR>   {<BR>    for(k2=1;k2<=n-1;k2++)<BR>    {<BR>     sr=0;sg=0;sb=0;<BR>     for(i=0;i<=2;i++)<BR>     {<BR>      for(j=0;j<=2;j++)<BR>      {<BR>       ki=k1-1;kj=k2-1;<BR>       if(((ki>=0);(ki<m);(kj>=0);(kj<m)))<BR>       {<BR>        sr=(int)(sr+r1[ki,kj]*h1[i,j]);<BR>        sg=(int)(sg+g1[ki,kj]*h1[i,j]);<BR>        sb=(int)(sb+b1[ki,kj]*h1[i,j]);<BR>       }<BR>      }<BR>     }<BR>     kp=k1-1;<BR>     kq=k2-1;<BR>     r2[kp,kq]=Math.Abs(sr);<BR>     g2[kp,kq]=Math.Abs(sg);<BR>     b2[kp,kq]=Math.Abs(sb);<BR>     if(r2[kp,kq]<0) r2[kp,kq]=0;<BR>     if(r2[kp,kq]>255) r2[kp,kq]=255;<BR>     if(g2[kp,kq]<0) g2[kp,kq]=0;<BR>     if(g2[kp,kq]>255) g2[kp,kq]=255;<BR>     if(b2[kp,kq]<0) b2[kp,kq]=0;<BR>     if(b2[kp,kq]>255) b2[kp,kq]=255;<BR>     Color c1=Color.FromArgb(r2[kp,kq],g2[kp,kq],b2[kp,kq]);<BR>     box1.SetPixel(k1,k2,c1);</P>
<P><BR>    }<BR>    this.pictureBox2.Image=box1;<BR>   }<BR>  }<BR> }<BR>}<BR></P>
举报 回复(0) 喜欢(0)     评分
tan
tan
路人甲
路人甲
  • 注册日期2006-08-31
  • 发帖数12
  • QQ
  • 铜币188枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2007-05-13 18:09
<P>不会吧,遥感院的还这样考啊,太难了</P>
举报 回复(0) 喜欢(0)     评分
游客

返回顶部