• 大小: 1.18MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-25
  • 语言: C#
  • 标签: 椒盐噪声  VS2010  

资源简介

数字图像加噪C#小程序,可加入椒盐噪声和高斯白噪声,希望对需要的人有用。

资源截图

代码片段和文件信息

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.IO;

namespace bitmap_noise
{
    public partial class Form1 : Form
    {
        string strFileParth = “.\\“;
        int m_nImageWidth = 0;
        int m_nImageHeight = 0;
        Bitmap m_bitmapOrigin;

        public Form1()
        {
            InitializeComponent();
        }

        private void OpenImageFile()
        {
            Stream myStream = null;
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.InitialDirectory = strFileParth;
            openFileDialog1.Filter = “BMP files (*.bmp)|*.bmp|JPG files (*.jpg)|*.jpg|All files (*.*)|*.*“;
            openFileDialog1.FilterIndex = 3;
            openFileDialog1.RestoreDirectory = true;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    if ((myStream = openFileDialog1.OpenFile()) != null)
                    {
                        strFileParth = openFileDialog1.FileName;
                        using (myStream)
                        {
                            // Insert code to read the stream here.
                            Bitmap bitmapOrigin = new Bitmap(myStream true);
                            int nWidth = bitmapOrigin.Width;
                            int nHeight = bitmapOrigin.Height;

                            textBoxFileName.Clear();
                            textBoxFileName.AppendText(openFileDialog1.FileName);
                            textBoxFileName.Width = nWidth;

                            pictureBoxOrigin.Left = 10;
                            pictureBoxOrigin.Width = nWidth;
                            pictureBoxOrigin.Height = nHeight;
                            pictureBoxOrigin.Image = bitmapOrigin;
                            pictureBoxOrigin.Refresh();

                            if (nWidth < 350)
                                tabControl1.Width = 350;
                            else
                                tabControl1.Width = nWidth + 30;

                            if (nHeight < 180)
                                tabControl1.Height = 180;
                            else
                                tabControl1.Height = nHeight + 90;

                            m_nImageWidth = nWidth;
                            m_nImageHeight = nHeight;

                            m_bitmapOrigin = bitmapOrigin;
                        }

                        myStream.Close();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(“Error: Could not read file from disk. Original error: “ + ex.Message);
                }
            }
        }

        pri

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     553554  2012-04-19 11:40  bitmap_noise_project\bin\Release\ararat.bmp

     文件     553554  2012-04-19 11:41  bitmap_noise_project\bin\Release\australia.bmp

     文件      28672  2012-05-16 13:13  bitmap_noise_project\bin\Release\bitmap_noise.exe

     文件      40448  2012-05-16 13:13  bitmap_noise_project\bin\Release\bitmap_noise.pdb

     文件      11600  2012-05-16 13:13  bitmap_noise_project\bin\Release\bitmap_noise.vshost.exe

     文件        490  2010-03-17 22:39  bitmap_noise_project\bin\Release\bitmap_noise.vshost.exe.manifest

     文件      28521  2008-04-14 20:00  bitmap_noise_project\bin\Release\Blue hills.jpg

     文件     553554  2012-04-19 11:39  bitmap_noise_project\bin\Release\hongkong.bmp

     文件     422174  2012-04-18 15:04  bitmap_noise_project\bin\Release\moon.bmp

     文件       2094  2012-05-16 13:04  bitmap_noise_project\bin\Release\readme.html

     文件      12344  2012-05-16 13:11  bitmap_noise_project\BitmapNoise.cs

     文件      21630  2012-05-16 13:11  bitmap_noise_project\BitmapNoise.Designer.cs

     文件      20815  2012-05-16 13:11  bitmap_noise_project\BitmapNoise.resx

     文件       3808  2012-04-25 16:00  bitmap_noise_project\bitmap_noise.csproj

     文件        865  2012-05-16 13:10  bitmap_noise_project\bitmap_noise.sln

    ..A..H.     19968  2012-05-16 13:10  bitmap_noise_project\bitmap_noise.suo

     文件          1  2012-04-25 15:58  bitmap_noise_project\ClassDiagram1.cd

     文件      21676  2012-04-25 15:54  bitmap_noise_project\Form1.Designer.cs

     文件      21017  2012-04-25 15:54  bitmap_noise_project\Form1.resx

     文件       2390  2012-05-16 13:11  bitmap_noise_project\obj\x86\Debug\bitmap_noise.csproj.FileListAbsolute.txt

     文件      29184  2012-05-16 13:11  bitmap_noise_project\obj\x86\Debug\bitmap_noise.exe

     文件      10228  2012-05-16 13:11  bitmap_noise_project\obj\x86\Debug\bitmap_noise.Form1.resources

     文件      34304  2012-05-16 13:11  bitmap_noise_project\obj\x86\Debug\bitmap_noise.pdb

     文件        180  2012-05-16 13:09  bitmap_noise_project\obj\x86\Debug\bitmap_noise.Properties.Resources.resources

     文件       4440  2012-04-19 11:16  bitmap_noise_project\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       6712  2012-05-16 13:11  bitmap_noise_project\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       1180  2012-05-16 13:11  bitmap_noise_project\obj\x86\Debug\GenerateResource.read.1.tlog

     文件       1782  2012-05-16 13:11  bitmap_noise_project\obj\x86\Debug\GenerateResource.write.1.tlog

     文件       8626  2012-04-19 11:26  bitmap_noise_project\obj\x86\Debug\ResolveAssemblyReference.cache

     文件       2426  2012-05-16 13:13  bitmap_noise_project\obj\x86\Release\bitmap_noise.csproj.FileListAbsolute.txt

............此处省略29个文件信息

评论

共有 条评论