資源簡介
基于著名的大津閾值(Otsu Thresholding)法實現的自適應閾值分割程序,C#寫的,導入VS項目中直接運行可見效果。

代碼片段和文件信息
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;
namespace?OtsuThreshold
{
????public?partial?class?Form1?:?Form
????{
????????private?Otsu?ot?=?new?Otsu();
????????private?Bitmap?org;
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????if?(openFileDialog1.ShowDialog()?==?DialogResult.OK)
????????????{
????????????????pictureBox1.Image?=?Bitmap.FromFile(openFileDialog1.FileName);
????????????????org?=?(Bitmap)pictureBox1.Image.Clone();
????????????}
????????}
????????private?void?button3_Click(object?sender?EventArgs?e)
????????{
????????????if?(saveFileDialog1.ShowDialog()?==?DialogResult.OK)
????????????{
????????????????pictureBox1.Image.Save(saveFileDialog1.FileName);
????????????}
????????}
????????private?void?button2_Click(object?sender?EventArgs?e)
????????{
????????????Bitmap?temp?=?(Bitmap)org.Clone();
????????????ot.Convert2GrayScaleFast(temp);
????????????int?otsuThreshold=?ot.getOtsuThreshold((Bitmap)temp);
????????????ot.threshold(tempotsuThreshold);
????????????textBox1.Text?=?otsuThreshold.ToString();
????????????pictureBox1.Image?=?temp;
????????}
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????org?=?(Bitmap)pictureBox1.Image.Clone();
????????}
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2009-07-21?03:09??OtsuThreshold\
?????目錄???????????0??2009-07-20?07:03??OtsuThreshold\OtsuThreshold\
?????目錄???????????0??2009-07-21?03:09??OtsuThreshold\OtsuThreshold\bin\
?????目錄???????????0??2009-07-21?03:21??OtsuThreshold\OtsuThreshold\bin\Debug\
?????文件??????146944??2009-07-21?06:51??OtsuThreshold\OtsuThreshold\bin\Debug\OtsuThreshold.exe
?????文件???????14328??2009-07-21?03:54??OtsuThreshold\OtsuThreshold\bin\Debug\OtsuThreshold.vshost.exe
?????文件?????????490??2007-07-21?01:33??OtsuThreshold\OtsuThreshold\bin\Debug\OtsuThreshold.vshost.exe.manifest
?????文件????????1534??2009-07-20?07:03??OtsuThreshold\OtsuThreshold\Form1.cs
?????文件????????5836??2009-07-20?07:03??OtsuThreshold\OtsuThreshold\Form1.Designer.cs
?????文件??????207751??2009-07-20?07:03??OtsuThreshold\OtsuThreshold\Form1.resx
?????文件????????4896??2009-07-20?07:03??OtsuThreshold\OtsuThreshold\Otsu.cs
?????文件????????3821??2009-07-21?03:21??OtsuThreshold\OtsuThreshold\OtsuThreshold.csproj
?????文件?????????505??2009-07-21?03:09??OtsuThreshold\OtsuThreshold\Program.cs
?????目錄???????????0??2009-07-21?03:09??OtsuThreshold\OtsuThreshold\Properties\
?????文件????????1456??2009-07-21?03:09??OtsuThreshold\OtsuThreshold\Properties\AssemblyInfo.cs
?????文件????????2855??2009-07-21?03:09??OtsuThreshold\OtsuThreshold\Properties\Resources.Designer.cs
?????文件????????5612??2009-07-21?03:09??OtsuThreshold\OtsuThreshold\Properties\Resources.resx
?????文件????????1098??2009-07-21?03:09??OtsuThreshold\OtsuThreshold\Properties\Settings.Designer.cs
?????文件?????????249??2009-07-21?03:09??OtsuThreshold\OtsuThreshold\Properties\Settings.settings
?????文件?????????929??2009-07-21?03:09??OtsuThreshold\OtsuThreshold.sln
- 上一篇:C#抓包程序含源代碼
- 下一篇:財務管理系統程序(c#源代碼)
評論
共有 條評論