资源简介
基于RGB颜色的K-means图像分割。C#工程代码。交流学习
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Color_Seg_Kmeans
{
public partial class Form1 : Form
{
Graphics graph1;
Graphics graph2;
Kmeans img = new Kmeans();
public static int k;
public Form1()
{
InitializeComponent();
graph1 = OldImage.CreateGraphics();
graph2 = NewImage.CreateGraphics();
img.SetControls(OldImage NewImage ColorPanel InfoPanel);
}
private void LoadBtn_Click(object sender EventArgs e)
{
try
{
ColorPanel.Controls.Clear();
img.Clear(graph1 BackColor);
img.Clear(graph2 BackColor);
img.Load();
}
catch
{
MessageBox.Show(“Load file error.“ “Error“ MessageBoxButtons.OK MessageBoxIcon.Error);
}
}
private void SaveBtn_Click(object sender EventArgs e)
{
try
{
if (NewImage.Image == null) throw new NullReferenceException();
img.Save();
}
catch (NullReferenceException)
{
MessageBox.Show(“Where an image? Load it.“ “Error“ MessageBoxButtons.OK MessageBoxIcon.Error);
}
}
private void ClearBtn_Click(object sender EventArgs e)
{
ColorPanel.Controls.Clear();
InfoPanel.Controls.Clear();
img.Clear(graph1 BackColor);
img.Clear(graph2 BackColor);
NewImage.Image = null;
}
private void DoBtn_Click(object sender EventArgs e)
{
img.Restore1();
InfoPanel.Controls.Clear();
ColorPanel.Controls.Clear();
img.Clear(graph2 BackColor);
NewImage.Image = null;
try
{
k = int.Parse(Kvalue.Text);
if (k <= 0 || k > 20) throw new OverflowException();
if (OldImage.Image == null) throw new NullReferenceException();
img.ImageKmeans();
}
catch (FormatException)
{
MessageBox.Show(“Uncorrect k: k is NaN.“ “Error“ MessageBoxButtons.OK MessageBoxIcon.Error);
}
catch (OverflowException)
{
MessageBox.Show(“Uncorrect k: k is out of range (1-20).“ “Error“ MessageBoxButtons.OK MessageBoxIcon.Error);
}
catch (NullReferenceException)
{
MessageBox.Show(“For segmentation you need an image.“ “Error“ MessageBoxButtons.OK MessageBoxIcon.Error);
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-05-15 17:24 Color_Seg_Kmeans\
目录 0 2019-05-15 17:24 Color_Seg_Kmeans\.vs\
目录 0 2019-05-15 17:24 Color_Seg_Kmeans\.vs\Color_Seg_Kmeans\
目录 0 2019-05-15 17:24 Color_Seg_Kmeans\.vs\Color_Seg_Kmeans\v15\
文件 78848 2019-05-16 21:52 Color_Seg_Kmeans\.vs\Color_Seg_Kmeans\v15\.suo
目录 0 2019-05-15 17:24 Color_Seg_Kmeans\.vs\Color_Seg_Kmeans\v15\Server\
目录 0 2019-05-15 17:24 Color_Seg_Kmeans\.vs\Color_Seg_Kmeans\v15\Server\sqlite3\
文件 0 2019-05-15 17:24 Color_Seg_Kmeans\.vs\Color_Seg_Kmeans\v15\Server\sqlite3\db.lock
文件 598016 2019-05-16 20:31 Color_Seg_Kmeans\.vs\Color_Seg_Kmeans\v15\Server\sqlite3\storage.ide
文件 32768 2019-05-16 21:45 Color_Seg_Kmeans\.vs\Color_Seg_Kmeans\v15\Server\sqlite3\storage.ide-shm
文件 4663872 2019-05-16 21:52 Color_Seg_Kmeans\.vs\Color_Seg_Kmeans\v15\Server\sqlite3\storage.ide-wal
目录 0 2019-05-16 21:51 Color_Seg_Kmeans\Color_Seg_Kmeans\
文件 1147 2019-05-15 17:24 Color_Seg_Kmeans\Color_Seg_Kmeans.sln
文件 189 2019-05-15 17:24 Color_Seg_Kmeans\Color_Seg_Kmeans\App.config
目录 0 2019-05-16 11:26 Color_Seg_Kmeans\Color_Seg_Kmeans\bin\
目录 0 2019-05-15 21:12 Color_Seg_Kmeans\Color_Seg_Kmeans\bin\Debug\
文件 20992 2019-05-16 21:51 Color_Seg_Kmeans\Color_Seg_Kmeans\bin\Debug\Color_Seg_Kmeans.exe
文件 189 2019-05-15 17:24 Color_Seg_Kmeans\Color_Seg_Kmeans\bin\Debug\Color_Seg_Kmeans.exe.config
文件 44544 2019-05-16 21:51 Color_Seg_Kmeans\Color_Seg_Kmeans\bin\Debug\Color_Seg_Kmeans.pdb
目录 0 2019-05-16 11:26 Color_Seg_Kmeans\Color_Seg_Kmeans\bin\Release\
文件 19968 2019-05-16 21:51 Color_Seg_Kmeans\Color_Seg_Kmeans\bin\Release\Color_Seg_Kmeans.exe
文件 189 2019-05-15 17:24 Color_Seg_Kmeans\Color_Seg_Kmeans\bin\Release\Color_Seg_Kmeans.exe.config
文件 44544 2019-05-16 21:51 Color_Seg_Kmeans\Color_Seg_Kmeans\bin\Release\Color_Seg_Kmeans.pdb
文件 3657 2019-05-15 21:11 Color_Seg_Kmeans\Color_Seg_Kmeans\Color_Seg_Kmeans.csproj
文件 3680 2019-05-16 21:51 Color_Seg_Kmeans\Color_Seg_Kmeans\Form1.cs
文件 16780 2019-05-16 21:51 Color_Seg_Kmeans\Color_Seg_Kmeans\Form1.Designer.cs
文件 6017 2019-05-16 21:51 Color_Seg_Kmeans\Color_Seg_Kmeans\Form1.resx
文件 14625 2019-05-16 20:37 Color_Seg_Kmeans\Color_Seg_Kmeans\Kmeans.cs
目录 0 2019-05-16 11:26 Color_Seg_Kmeans\Color_Seg_Kmeans\obj\
目录 0 2019-05-16 21:51 Color_Seg_Kmeans\Color_Seg_Kmeans\obj\Debug\
文件 42 2019-05-15 17:35 Color_Seg_Kmeans\Color_Seg_Kmeans\obj\Debug\Color_Seg_Kmeans.csproj.CoreCompileInputs.cache
............此处省略35个文件信息
相关资源
- C# 调用win32 api函数-user32.dll详细说明
- C# 调用BarTender打印条码DEMO
- 大型比赛竞赛抽签系统 可打印 c# vs
- C#编写的Gerber查看器
- lua C# .Net4.0 vs2010 LuaInterface
- C#十六进制编辑器
- 明华URF-35H读卡器 C#读写源码 为大家
- C#文件流读取CSV文件
- c#读写PDF文件sql
- C# winform Socket大文件传输
- c#车牌识别系统附30张测试图片
- 《C#面向对象程序设计》源代码(CS)
- 金旭亮《C#面向对象程序设计》教案
- 试题库管理系统毕业论文(C#)源程序
- 学校网站原代码(C#.NET)
- C#-数据库操作技术-员工管理系统
- c#web开发入门经典
- C#与Matlab混合编程的几种方式
- c# 开发与 mysql数据库实现的增删改查
- C#异步操作 异步查询数据库 异步处理
- Basler相机通过IO触发源码
- [源代码] 《领域驱动设计 (C# 2008 实
- 松下PLC与C#通讯串口调试入门教程.z
- USB 继电器控制器 LCUS-1 保证能用 c#
- C# AES加密解密小工具
- C#圆形按钮,非常漂亮动态~~
- [精]C#仿QQ右下角弹出提示框()
- C#进程间通信-共享内存代码
- 有史以来最简单的三层(C#)
- vb调用c#编写的串口DLL文件(vb源码
评论
共有 条评论