• 大小: 59KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-09
  • 语言: C#
  • 标签: Wallis滤波  

资源简介

基于VS2010的C#代码编写的Wallisl滤波,可直接运行

资源截图

代码片段和文件信息

//Wallis filtering for optical images
//spring 2016
//Hohai University
//All right reserved

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;

                                                  

namespace Wallis滤波
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        Bitmap curBitmap;
        private void OpenImage_Click(object sender EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            //ofd.Filter = “bmp files(*.bmp)|*.bmp|jpg files(*.jpg)|*.jpg“;
            ofd.Filter = “*.bmp;*.jpp;“ + “(*.bmp;*.jpg)|*.bmp;*.jpg“;
            ofd.title = “加载原始影像“;
            ofd.InitialDirectory = “E:\\“;
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                curBitmap = (Bitmap)Image.FromFile(ofd.FileName);
                pictureBox1.Image = curBitmap;
            }
            Invalidate();
        }
        //Graphics g;
        private void Form1_Paint(object sender PaintEventArgs e)
        {
            //g = e.Graphics;
            //if (curBitmap!=null)
            //{
            //    g.DrawImage(curBitmap 160 20 curBitmap.Width curBitmap.Height);
            //}
        }

        private void Close_Click(object sender EventArgs e)
        {
            this.Close();
        }

       public double GetGrayAver(byte[]Curint WinRowint WinColint Widthint Height)
        {
       
            
            int bytes = Width*Height;
            int halfCol = WinCol / 2;
            int halfRow = WinRow / 2;
            double sum = 0;
            double aver = 0;

            for (int i = 0; i < WinCol * WinRow;i++ )
            {
                sum = sum + Cur[i];
            }
            aver = sum / (WinCol * WinRow);
            return aver;
        }

       public double GetVariance(double averbyte[] Cur int WinRow int WinCol)
       {
           double data = 0;
           double Vari = 0;
           for (int i = 0; i < WinCol * WinRow;i++ )
           {
               data = data + (aver - Cur[i]) * (aver - Cur[i]);
           }
           Vari = data / (WinRow * WinCol);
           return Vari;


       }
        //public byte[] GetGrayValue(byte[]Tempint WinRowint WinColdouble meandouble sigmadouble meanValuedouble sigmaValuedouble B_Valuedouble C_Value)
        //{
        //    byte[] TempResult=new byte[WinRow*WinCol];
        //    double r1r0;
        //    if (C_Value == 1)
        //    {
        //        r1 = sigmaValue / sigma;
        //        r0 = B_Value * meanValue + (1 - B_Value - r1) * mean;
        //    }
        //    else
        //    {
        //        r1 = C_Value * sigmaValue / (C_Value * sigma

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2016-03-29 16:39  Wallis滤波\
     目录           0  2016-03-29 16:39  Wallis滤波\Wallis滤波\
     目录           0  2016-03-29 16:39  Wallis滤波\Wallis滤波\bin\
     目录           0  2016-03-29 16:39  Wallis滤波\Wallis滤波\bin\Debug\
     文件       11776  2016-03-31 09:27  Wallis滤波\Wallis滤波\bin\Debug\Wallis滤波.exe
     文件       32256  2016-03-31 09:27  Wallis滤波\Wallis滤波\bin\Debug\Wallis滤波.pdb
     文件       11600  2016-03-31 15:50  Wallis滤波\Wallis滤波\bin\Debug\Wallis滤波.vshost.exe
     文件         490  2015-10-30 15:19  Wallis滤波\Wallis滤波\bin\Debug\Wallis滤波.vshost.exe.manifest
     文件        7845  2016-03-31 15:50  Wallis滤波\Wallis滤波\Form1.cs
     文件        5667  2016-03-29 14:17  Wallis滤波\Wallis滤波\Form1.Designer.cs
     文件        5817  2016-03-29 14:17  Wallis滤波\Wallis滤波\Form1.resx
     目录           0  2016-03-29 16:39  Wallis滤波\Wallis滤波\obj\
     目录           0  2016-03-29 16:39  Wallis滤波\Wallis滤波\obj\x86\
     目录           0  2016-03-31 09:27  Wallis滤波\Wallis滤波\obj\x86\Debug\
     文件        5420  2016-03-28 13:53  Wallis滤波\Wallis滤波\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
     文件        6347  2016-03-31 09:27  Wallis滤波\Wallis滤波\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     目录           0  2016-03-28 10:44  Wallis滤波\Wallis滤波\obj\x86\Debug\TempPE\
     文件        1338  2016-03-31 15:50  Wallis滤波\Wallis滤波\obj\x86\Debug\Wallis滤波.csproj.FileListAbsolute.txt
     文件         975  2016-03-29 14:17  Wallis滤波\Wallis滤波\obj\x86\Debug\Wallis滤波.csproj.GenerateResource.Cache
     文件        9214  2016-03-29 19:43  Wallis滤波\Wallis滤波\obj\x86\Debug\Wallis滤波.csprojResolveAssemblyReference.cache
     文件       11776  2016-03-31 09:27  Wallis滤波\Wallis滤波\obj\x86\Debug\Wallis滤波.exe
     文件         180  2016-03-29 14:17  Wallis滤波\Wallis滤波\obj\x86\Debug\Wallis滤波.Form1.resources
     文件       32256  2016-03-31 09:27  Wallis滤波\Wallis滤波\obj\x86\Debug\Wallis滤波.pdb
     文件         180  2016-03-29 14:11  Wallis滤波\Wallis滤波\obj\x86\Debug\Wallis滤波.Properties.Resources.resources
     文件         493  2016-03-28 10:44  Wallis滤波\Wallis滤波\Program.cs
     目录           0  2016-03-29 16:39  Wallis滤波\Wallis滤波\Properties\
     文件        1356  2016-03-28 10:44  Wallis滤波\Wallis滤波\Properties\AssemblyInfo.cs
     文件        2876  2016-03-28 10:44  Wallis滤波\Wallis滤波\Properties\Resources.Designer.cs
     文件        5612  2016-03-28 10:44  Wallis滤波\Wallis滤波\Properties\Resources.resx
     文件        1099  2016-03-28 10:44  Wallis滤波\Wallis滤波\Properties\Settings.Designer.cs
     文件         249  2016-03-28 10:44  Wallis滤波\Wallis滤波\Properties\Settings.settings
............此处省略3个文件信息

评论

共有 条评论

相关资源