資源簡介
該程序是基于C#的圖像分割算法,可以直接使用

代碼片段和文件信息
/************************************************************************
?*?數字圖像處理--VC#.NET編程與實驗?第8章?圖像分割
?*?ImageSegmentation.Form1.cs
?*?Version?1.0?2010.01.29
?*?Author??Xie-Hua?Sun?
?************************************************************************/
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;
namespace?ImageSegmenation
{
????public?partial?class?Form1?:?Form
????{
????????Bitmap?curBitmap?=?null;
????????int?iw?ih;
????????public?Form1()
????????{
????????????InitializeComponent();
????????????label1.Text?=?““;
????????????label2.Text?=?““;
????????}
????????//打開????????
????????private?void?menuItem2_Click(object?sender?EventArgs?e)
????????{
????????????OpenFileDialog?open?=?new?OpenFileDialog();
????????????open.Filter?=?“圖像文件(*.bmp;*.jpg;*gif;*png;*.tif;*.wmf)|“
????????????????????????+?“*.bmp;*jpg;*gif;*png;*.tif;*.wmf“;
????????????if?(open.ShowDialog()?==?DialogResult.OK)
????????????{
????????????????try
????????????????{
????????????????????curBitmap?=?(Bitmap)Image.FromFile(open.FileName);
????????????????}
????????????????catch?(Exception?exp)?{?MessageBox.Show(exp.Message);?}
????????????????pictureBox1.Refresh();
????????????????pictureBox1.Image?=?curBitmap;
????????????????label1.Text?=?“原圖“;
????????????????iw?=?curBitmap.Width;
????????????????ih?=?curBitmap.Height;
????????????}????????????
????????}
????????//保存
????????private?void?menuItem3_Click(object?sender?EventArgs?e)
????????{
????????????string?str;
????????????SaveFileDialog?saveFileDialog1?=?new?SaveFileDialog();
????????????saveFileDialog1.Filter?=?“圖像文件(*.BMP)|*.BMP|All?File(*.*)|*.*“;
????????????saveFileDialog1.ShowDialog();
????????????str?=?saveFileDialog1.FileName;
????????????pictureBox2.Image.Save(str);
????????}
????????//退出
????????private?void?menuItem4_Click(object?sender?EventArgs?e)
????????{
????????????this.Close();
????????}
????????????????
????????//8.1?邊緣檢測===========================================================
????????
????????//Kirsch算子
????????private?void?menuItem10_Click(object?sender?EventArgs?e)
????????{
????????????if?(curBitmap?!=?null)
????????????{
????????????????this.Text?=?“第8章?圖像分割?邊緣檢測?Kirsch算子?作者?孫燮華“;
????????????????Bitmap?bm?=?new?Bitmap(pictureBox1.Image);
????????????????????????????????
????????????????//1:?Kirsch邊緣檢測
????????????????bm?=?detect(bm?iw?ih?1?500);
????????????????pictureBox2.Refresh();
????????????????pictureBox2.Image?=?bm;
????????????????label2.Text?=?“邊緣檢測結果“;
????????????}
????????}
????????/*-------------------------------------------------------------------------
?????????*?pix????--待檢測圖像數組
?????????*?iw?ih?--待檢測圖像寬高
?????????*?num????--算子代號.1:Kirsch算子;2:Laplace算子;3:Prewitt算子;5:Sobel算子
?????????*?thresh?--邊緣檢測閾值T
?????????*?flag???--銳化與邊緣檢測標志?false:銳化;?tru
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????196662??2009-08-29?19:15??ch8?圖像分割\image\ball.bmp
?????文件?????196662??2009-08-31?11:39??ch8?圖像分割\image\Hough.bmp
?????文件??????11921??2005-05-08?21:03??ch8?圖像分割\image\Lena.jpg
?????文件??????66614??2005-06-23?18:28??ch8?圖像分割\image\PEPPERS.bmp
?????文件?????196662??2009-08-29?19:04??ch8?圖像分割\image\差影法.bmp
?????文件?????196662??2009-08-29?19:02??ch8?圖像分割\image\差影背景.bmp
?????文件??????36864??2010-08-03?20:20??ch8?圖像分割\ImageSegmenation\bin\Debug\ImageSegmenation.exe
?????文件??????67072??2010-08-03?20:20??ch8?圖像分割\ImageSegmenation\bin\Debug\ImageSegmenation.pdb
?????文件???????5632??2005-12-08?14:51??ch8?圖像分割\ImageSegmenation\bin\Debug\ImageSegmenation.vshost.exe
?????文件??????26112??2007-05-07?22:28??ch8?圖像分割\ImageSegmenation\bin\Release\ImageSegmenation.pdb
?????文件??????41502??2010-08-03?20:20??ch8?圖像分割\ImageSegmenation\Form1.cs
?????文件??????13984??2010-01-10?10:01??ch8?圖像分割\ImageSegmenation\Form1.Designer.cs
?????文件???????6011??2010-01-10?10:01??ch8?圖像分割\ImageSegmenation\Form1.resx
?????文件???????3506??2010-01-20?22:36??ch8?圖像分割\ImageSegmenation\ImageSegmenation.csproj
?????文件????????920??2010-02-02?21:11??ch8?圖像分割\ImageSegmenation\ImageSegmenation.sln
????..A..H.?????19456??2014-03-07?14:45??ch8?圖像分割\ImageSegmenation\ImageSegmenation.suo
?????文件???????1429??2010-01-25?20:46??ch8?圖像分割\ImageSegmenation\obj\Debug\ImageSegmenation.csproj.FileListAbsolute.txt
?????文件????????842??2010-02-02?21:11??ch8?圖像分割\ImageSegmenation\obj\Debug\ImageSegmenation.csproj.GenerateResource.Cache
?????文件??????36864??2010-08-03?20:20??ch8?圖像分割\ImageSegmenation\obj\Debug\ImageSegmenation.exe
?????文件????????180??2010-08-03?20:20??ch8?圖像分割\ImageSegmenation\obj\Debug\ImageSegmenation.Form1.resources
?????文件??????67072??2010-08-03?20:20??ch8?圖像分割\ImageSegmenation\obj\Debug\ImageSegmenation.pdb
?????文件????????180??2010-08-03?20:20??ch8?圖像分割\ImageSegmenation\obj\Debug\ImageSegmenation.Properties.Resources.resources
?????文件???????4608??2010-01-20?22:36??ch8?圖像分割\ImageSegmenation\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
?????文件????????678??2010-02-18?16:08??ch8?圖像分割\ImageSegmenation\obj\ImageSegmenation.csproj.FileList.txt
?????文件???????8403??2014-03-10?15:22??ch8?圖像分割\ImageSegmenation\obj\ImageSegmenation.csproj.FileListAbsolute.txt
?????文件????????842??2007-05-07?20:06??ch8?圖像分割\ImageSegmenation\obj\Release\ImageSegmenation.csproj.GenerateResource.Cache
?????文件????????180??2007-05-07?20:06??ch8?圖像分割\ImageSegmenation\obj\Release\ImageSegmenation.Form1.resources
?????文件??????26112??2007-05-07?22:28??ch8?圖像分割\ImageSegmenation\obj\Release\ImageSegmenation.pdb
?????文件????????180??2007-05-07?20:06??ch8?圖像分割\ImageSegmenation\obj\Release\ImageSegmenation.Properties.Resources.resources
?????文件????????475??2007-05-07?19:30??ch8?圖像分割\ImageSegmenation\Program.cs
............此處省略21個文件信息
- 上一篇:asp.net實現購物車的代碼
- 下一篇:學生會管理系統
評論
共有 條評論