资源简介
这个程序有两种对图像的读取办法,1.打开摄像头拍照提取。2直接读取文件中的图片,并将其轮廓矢量化,保存得到相应的文本数据。

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using HalconDotNet;
namespace draw_Contours
{
public partial class Form1 : Form
{
public Hobject srcsrc_image;
HTuple windowIDhwindow;
bool TP = false OC = false OP = false DW = false;
public Form1()
{
InitializeComponent();
src = new Hobject();
//src_image = new Hobject();
HOperatorSet.SetWindowAttr(“background_color“ “green“);
HOperatorSet.OpenWindow(0 0 this.pictureBox1.Width this.pictureBox1.Height this.pictureBox1.Handle “visible“ ““ out windowID);
}
Thread dispig;
private string imagePath;
HTuple width = null height = null;
string[] writeLineBeginRow writeLineBeginCol writeLineEndRow writeLineEndCol writeLineNR writeLineNC writeLineDist;
int i = 0;
private void btn_openCamera_Click(object sender EventArgs e)
{
i = 1;
if (btn_openCamera.Text == “Open Camera“)
{
btn_openCamera.Text = “Close Camera“;
OC = true;
dispig = new Thread(getin);
dispig.Start();
}
else if(btn_openCamera.Text==“Close Camera“)
{
btn_openCamera.Text = “Open Camera“;
TP = false; OC = false; OP = false; DW = false;
dispig.Abort();
HOperatorSet.Closeframegrabber(hwindow);
}
}
public void getin()
{
HOperatorSet.GenEmptyObj(out src_image);
HOperatorSet.Openframegrabber(“DirectShow“ 1 1 0 0 0 0 “default“ 8 “rgb“ -1 “false“ “default“ “[0] Webcam SC-10HDD12636P“ 0 -1 out hwindow);
HOperatorSet.GrabImageStart(hwindow -1);
while (true)
{
HOperatorSet.GrabImageAsync(out src_image hwindow -1);
HOperatorSet.GetImageSize(src_imageout widthout height);
HOperatorSet.SetPart(hWindowControl1.HalconWindow 0 0 height width);
HOperatorSet.DispObj(src_image hWindowControl1.HalconWindow);
}
}
private void Form1_FormClosing(object sender FormClosingEventArgs e)
{
if (btn_openCamera.Text==“Close Camera“)
{
dispig.Abort();
HOperatorSet.Closeframegrabber(hwindow);
}
}
private void btn_takephoto_Click(object sender EventArgs e)
{
if (OC == true)
{
TP = true;
src = src_image.Clone();
HO
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-09-22 00:50 draw_Contours\
文件 189 2018-09-21 13:23 draw_Contours\App.config
文件 10954 2018-09-22 00:43 draw_Contours\Form1.Designer.cs
文件 10501 2018-09-22 00:50 draw_Contours\Form1.cs
文件 6603 2018-09-22 00:43 draw_Contours\Form1.resx
文件 525 2018-09-21 13:23 draw_Contours\Program.cs
目录 0 2018-09-21 13:23 draw_Contours\Properties\
文件 1324 2018-09-21 13:23 draw_Contours\Properties\AssemblyInfo.cs
文件 2839 2018-09-21 13:23 draw_Contours\Properties\Resources.Designer.cs
文件 5612 2018-09-21 13:23 draw_Contours\Properties\Resources.resx
文件 1100 2018-09-21 13:23 draw_Contours\Properties\Settings.Designer.cs
文件 249 2018-09-21 13:23 draw_Contours\Properties\Settings.settings
目录 0 2018-09-21 13:23 draw_Contours\bin\
目录 0 2018-09-21 20:14 draw_Contours\bin\Debug\
文件 17920 2018-09-22 00:50 draw_Contours\bin\Debug\draw_Contours.exe
文件 189 2018-09-21 13:23 draw_Contours\bin\Debug\draw_Contours.exe.config
文件 24064 2018-09-22 00:50 draw_Contours\bin\Debug\draw_Contours.pdb
文件 1409680 2016-10-28 00:54 draw_Contours\bin\Debug\halcondotnet.dll
文件 4357073 2016-10-27 00:02 draw_Contours\bin\Debug\halcondotnet.xm
文件 3880 2018-09-21 13:38 draw_Contours\draw_Contours.csproj
目录 0 2018-09-21 13:23 draw_Contours\obj\
目录 0 2018-09-22 00:43 draw_Contours\obj\Debug\
文件 9913 2018-09-22 00:42 draw_Contours\obj\Debug\DesignTimeResolveAssemblyReferences.cache
文件 7602 2018-09-21 13:23 draw_Contours\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
目录 0 2018-09-22 00:52 draw_Contours\obj\Debug\TempPE\
文件 0 2018-09-21 13:23 draw_Contours\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
文件 0 2018-09-21 13:23 draw_Contours\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
文件 0 2018-09-21 13:23 draw_Contours\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
文件 180 2018-09-22 00:43 draw_Contours\obj\Debug\draw_Contours.Form1.resources
文件 180 2018-09-21 13:39 draw_Contours\obj\Debug\draw_Contours.Properties.Resources.resources
文件 0 2018-09-22 00:50 draw_Contours\obj\Debug\draw_Contours.csproj.CopyComplete
............此处省略6个文件信息
- 上一篇:Color_Seg_Kmeans.zip
- 下一篇:解析空中三角测量
相关资源
- C# 在Winform中发布WebService
- C# 文件管理源码
- C#调用Photoshop打开图片源代码
- C#TreeView使用节点拖曳、节点右键菜单
- C# IP地址输入控件
- C#在一个窗口刷新更改另一个窗口控件
- C# TIP文件生成和拆解
- C#解析HL7消息的库135797
- C# OCR数字识别实例,采用TessnetOcr,对
- 考试管理系统 - C#源码
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
评论
共有 条评论