资源简介
1.在使用本代码前请先配置系统环境【很关键,否则不能采图】.
2.开发环境:VS2015 64位框架,Halcon12版64位.
3.参考官方Halcon源码编写.
4.目前只有采图功能,下载后可直接使用.
5.需要SDK采图的联系WX:zh2543685
2.开发环境:VS2015 64位框架,Halcon12版64位.
3.参考官方Halcon源码编写.
4.目前只有采图功能,下载后可直接使用.
5.需要SDK采图的联系WX:zh2543685
代码片段和文件信息
using System;
using HalconDotNet;
using System.Windows.Forms;
namespace LMI
{
public class Camera
{
public HTuple hv_AcqHandle = new HTuple();
public HTuple m_ExposureTime = new HTuple();
public bool m_bBusy = new bool();
public string m_strIPAddr = null;
public int m_nIPPort = new int();
public Camera()
{
hv_AcqHandle = -1;
m_ExposureTime = 1000;
m_strIPAddr = “127.0.0.1“;
m_nIPPort = 8080;
m_bBusy = false;
}
public bool IniCamra()
{
bool Result = false;
try
{
//打开图像采集卡
HOperatorSet.Openframegrabber(“GenICamTL“ 0 0 0 0 0 0 “progressive“ 16 “rgb“ -1 “false“ “default“ m_strIPAddr 0 -1 out hv_AcqHandle);
HOperatorSet.SetframegrabberParam(hv_AcqHandle “grab_timeout“ -1);
HOperatorSet.GrabImageStart(hv_AcqHandle -1);
Go2GenTL_SetExposure(hv_AcqHandle m_ExposureTime 1);
Result = true;
}
catch (Exception)
{
Result = false;
}
return Result;
}
public void Go2GenTL_SetExposure(HTuple hv_AcqHandle HTuple hv_exposure int i)
{
try
{
HOperatorSet.SetframegrabberParam(hv_AcqHandle “Exposure“ hv_exposure);
}
catch (Exception)
{
MessageBox.Show(“相机“ + i + “设置曝光失败!“);
}
}
public void Go2GenTL_Exposure(HTuple hv_AcqHandle out HTuple hv_exposure int i)
{
hv_exposure = null;
try
{
HOperatorSet.GetframegrabberParam(hv_AcqHandle “Exposure“ out hv_exposure);
}
catch (Exception)
{
MessageBox.Show(“相机“ + i + “获取曝光失败!“);
}
}
public void Go2GenTL_ImageSize(HTuple hv_AcqHandle out HTuple hv_Width out HTuple hv_Height)
{
HOperatorSet.GetframegrabberParam(hv_AcqHandle “image_width“ out hv_Width);
HOperatorSet.GetframegrabberParam(hv_AcqHandle “image_height“ out hv_Height);
return;
}
public void Go2GenTL_ParseData(Hobject ho_Image out Hobject ho_HeightMap out Hobject ho_Intensity
HTuple hv_Index out HTuple hv_frameCount out HTuple hv_Timestamp out HTuple hv_EncoderPosition
out HTuple hv_EncoderIndex out HTuple hv_Inputs out HTuple hv_xOffset out HTuple hv_xResolution
out HTuple hv_yOffset out HTuple hv_yResolution out HTuple hv_zOffset out HTuple hv_zResolution
out HTuple hv_Width out HTuple hv_Length out HTuple hv_HasIntensity out HTuple hv_NumScans)
{
// Stack for temporary objects
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-09-23 12:25 LMI\
目录 0 2019-09-23 12:25 LMI\.vs\
目录 0 2019-09-23 12:25 LMI\.vs\LMI\
目录 0 2019-09-23 12:25 LMI\.vs\LMI\v14\
文件 46080 2019-09-23 13:34 LMI\.vs\LMI\v14\.suo
目录 0 2019-09-23 13:29 LMI\LMI\
文件 189 2019-09-23 12:25 LMI\LMI\App.config
文件 11814 2019-09-23 13:14 LMI\LMI\Camera.cs
文件 7584 2019-09-23 13:10 LMI\LMI\Form1.Designer.cs
文件 7532 2019-09-23 13:29 LMI\LMI\Form1.cs
文件 5817 2019-09-23 13:10 LMI\LMI\Form1.resx
文件 6048 2019-09-23 13:05 LMI\LMI\LMI.csproj
文件 515 2019-09-23 12:25 LMI\LMI\Program.cs
目录 0 2019-09-23 12:25 LMI\LMI\Properties\
文件 1314 2019-09-23 12:25 LMI\LMI\Properties\AssemblyInfo.cs
文件 2819 2019-09-23 12:25 LMI\LMI\Properties\Resources.Designer.cs
文件 5612 2019-09-23 12:25 LMI\LMI\Properties\Resources.resx
文件 1090 2019-09-23 12:25 LMI\LMI\Properties\Settings.Designer.cs
文件 249 2019-09-23 12:25 LMI\LMI\Properties\Settings.settings
目录 0 2019-09-23 12:26 LMI\LMI\bin\
目录 0 2019-09-23 12:27 LMI\LMI\bin\Debug\
文件 189 2019-09-23 12:25 LMI\LMI\bin\Debug\LMI.exe.config
文件 22696 2019-09-23 12:25 LMI\LMI\bin\Debug\LMI.vshost.exe
文件 189 2019-09-23 12:25 LMI\LMI\bin\Debug\LMI.vshost.exe.config
文件 490 2018-09-15 15:29 LMI\LMI\bin\Debug\LMI.vshost.exe.manifest
文件 742456 2014-11-15 02:27 LMI\LMI\bin\Debug\hAcqGenICamTLxl.dll
文件 1279544 2014-11-15 02:27 LMI\LMI\bin\Debug\halcondotnetxl.dll
文件 54258232 2017-10-05 10:29 LMI\LMI\bin\Debug\halconxl.dll
目录 0 2019-09-23 12:25 LMI\LMI\bin\x64\
目录 0 2019-09-23 13:30 LMI\LMI\bin\x64\Debug\
文件 16384 2019-09-23 13:30 LMI\LMI\bin\x64\Debug\LMI.exe
............此处省略39个文件信息
评论
共有 条评论