资源简介
C#程序连接LMI3D相机,获取数据后通过halcon转化成png,12位深图像文件。再使用halcon计算,拟合平面,自动分割,计算平面高度。
代码片段和文件信息
using HalconDotNet;
using Lmi3d.GoSdk;
using Lmi3d.GoSdk.Messages;
using Lmi3d.Zen;
using Lmi3d.Zen.Io;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LMI_HalconAcqTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
string SENSOR_IP = “127.0.0.1“;
private void Form1_Load(object sender EventArgs e)
{
KApiLib.Construct();
GoSdkLib.Construct();
GoSystem system = new GoSystem();
GoSensor sensor;
KIpAddress ipAddress = KIpAddress.Parse(SENSOR_IP);
GoDataSet dataSet = new GoDataSet();
sensor = system.FindSensorByIpAddress(ipAddress);
sensor.Connect();
system.EnableData(true);
system.Start();
Console.WriteLine(“Waiting for Whole Part Data...“);
dataSet = system.ReceiveData(30000000);
for (UInt32 i = 0; i < dataSet.Count; i++)
{
GoDataMsg dataObj = (GoDataMsg)dataSet.Get(i);
switch (dataObj.MessageType)
{
case GoDataMessageType.UniformSurface:
{
GoSurfaceMsg surfaceMsg = (GoSurfaceMsg)dataObj;
long width = surfaceMsg.Width;
long length = surfaceMsg.Length;
long bufferSize = width * length;
IntPtr bufferPointer = surfaceMsg.Data;
HImage image = new HImage(“uint2“ (int)width (int)length bufferPointer);
HOperatorSet.WriteImage(image “png“0“C:\\Users\\zzheng\\Desktop\\123.png“);
//Console.WriteLine(“Whole Part Height Map received:“);
//Console.WriteLine(“ Buffer width: {0}“ width);
//Console.WriteLine(“ Buffer length: {0}“ length);
//short[] ranges = new short[bufferSize];
//Marshal.Copy(bufferPointer ranges 0 ranges.Length);
}
break;
}
}
system.Stop();
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-12-30 10:29 LMI_HalconAcqTest\
目录 0 2019-12-30 10:29 LMI_HalconAcqTest\.vs\
目录 0 2020-02-28 20:08 LMI_HalconAcqTest\.vs\LMI_HalconAcqTest\
目录 0 2019-12-30 10:29 LMI_HalconAcqTest\.vs\LMI_HalconAcqTest\v14\
文件 36864 2020-02-28 19:06 LMI_HalconAcqTest\.vs\LMI_HalconAcqTest\v14\.suo
目录 0 2020-02-28 20:09 LMI_HalconAcqTest\.vs\LMI_HalconAcqTest\v16\
文件 58880 2020-02-28 20:10 LMI_HalconAcqTest\.vs\LMI_HalconAcqTest\v16\.suo
目录 0 2020-02-28 20:09 LMI_HalconAcqTest\.vs\LMI_HalconAcqTest\v16\Server\
目录 0 2020-02-28 20:10 LMI_HalconAcqTest\.vs\LMI_HalconAcqTest\v16\Server\sqlite3\
文件 0 2020-02-28 20:09 LMI_HalconAcqTest\.vs\LMI_HalconAcqTest\v16\Server\sqlite3\db.lock
文件 667648 2020-02-28 20:09 LMI_HalconAcqTest\.vs\LMI_HalconAcqTest\v16\Server\sqlite3\storage.ide
目录 0 2020-02-28 20:09 LMI_HalconAcqTest\LMI_HalconAcqTest\
文件 189 2019-11-04 13:16 LMI_HalconAcqTest\LMI_HalconAcqTest\App.config
文件 1478 2019-11-04 13:20 LMI_HalconAcqTest\LMI_HalconAcqTest\Form1.Designer.cs
文件 2578 2020-02-28 20:09 LMI_HalconAcqTest\LMI_HalconAcqTest\Form1.cs
文件 5817 2019-11-04 13:20 LMI_HalconAcqTest\LMI_HalconAcqTest\Form1.resx
文件 5902 2020-02-28 19:05 LMI_HalconAcqTest\LMI_HalconAcqTest\LMI_HalconAcqTest.csproj
文件 529 2019-11-04 13:16 LMI_HalconAcqTest\LMI_HalconAcqTest\Program.cs
目录 0 2019-12-30 10:29 LMI_HalconAcqTest\LMI_HalconAcqTest\Properties\
文件 1342 2019-11-04 13:16 LMI_HalconAcqTest\LMI_HalconAcqTest\Properties\AssemblyInfo.cs
文件 2847 2019-11-04 13:16 LMI_HalconAcqTest\LMI_HalconAcqTest\Properties\Resources.Designer.cs
文件 5612 2019-11-04 13:16 LMI_HalconAcqTest\LMI_HalconAcqTest\Properties\Resources.resx
文件 1104 2019-11-04 13:16 LMI_HalconAcqTest\LMI_HalconAcqTest\Properties\Settings.Designer.cs
文件 249 2019-11-04 13:16 LMI_HalconAcqTest\LMI_HalconAcqTest\Properties\Settings.settings
目录 0 2019-12-30 10:29 LMI_HalconAcqTest\LMI_HalconAcqTest\bin\
目录 0 2019-12-30 10:29 LMI_HalconAcqTest\LMI_HalconAcqTest\obj\
目录 0 2019-12-30 10:29 LMI_HalconAcqTest\LMI_HalconAcqTest\obj\Debug\
文件 868 2019-11-04 13:16 LMI_HalconAcqTest\LMI_HalconAcqTest\obj\Debug\DesignTimeResolveAssemblyReferences.cache
文件 7357 2019-11-04 13:16 LMI_HalconAcqTest\LMI_HalconAcqTest\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 42 2019-12-18 12:16 LMI_HalconAcqTest\LMI_HalconAcqTest\obj\Debug\LMI_HalconAcqTest.csproj.CoreCompileInputs.cache
文件 130 2019-11-04 13:16 LMI_HalconAcqTest\LMI_HalconAcqTest\obj\Debug\LMI_HalconAcqTest.csproj.FileListAbsolute.txt
............此处省略29个文件信息
- 上一篇:C#财务记账软件源码
- 下一篇:C#编程速查宝典 20140416
相关资源
- halcon连接海康威视相机采集图形
- halcon C#交互式绘图InteractiveROI
- C#中WPF联合Halcon的一个学习(解决内存
- C#联合halcon实现鼠标滚轮事件
- c#联合halcon颜色识别
- halcon 采集笔记本摄像头相片并取灰度
- halcon联合C#实现图像实时采集使用Ba
- 指针仪表识别halcon代码
- Halcon联合C#编写的检测二维码窗体程序
- C#联合halcon二维码读取.zip
- Halcon导出的C#代码的调用及讨论
- 源代码C#、halcon深度学习软件系统-G
- Halcon 车牌识别 范例
- c#联合halcon编程,鼠标获取图像灰度值
- Halcon的HWindowControl控件在WinForm程序中
- Halcon结合C#二次开发读取图片并处理图
- halcon联合C#实现实时显示源码
- C#与halcon窗体控件交互
- halcon联合c#实现放大缩小移动图片
- Basler_Gige面阵相机C#基于Halcon显示的
- Halcon与C#混合窗体控件源代码
- halcon 与C#之HWindow鼠标控制图片缩放,
- 包含了halcon,C#编程,联合开发,机器
- C#联合halcon利用halcon控件实现鼠标拖拽
- C#结合Halcon,对图像也可以拍照进行轮
- C#基于Halcon实现Basler相机采图SDK
- Halcon生成的计算圆心C#代码
- Halcon C#实现图像的灰度化鼠标放大缩
- halcon联合C#车牌识别
- 将Halcon DeepLearning Tool工具生成的hdic
评论
共有 条评论