资源简介
C#封装basler,获取bitmap及hobject图像,内触发、外触发、获取单帧
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HalconDotNet;
using PylonC.NET;
using PylonC.NETSupportLibrary;
using COM.Aiscent.ALDI.Exceptions;
using System.Drawing;
namespace WindowsFormsApplication16
{
public class BaslerCamera : Camera
{
public override string CameraName
{
get { return _cameraName; }
set { _cameraName = value; }
}
public override int ExposureTime
{
get { return (int)GetFloatSetting(“ExposureTimeAbs“); }
set { _exposureTime = value; SetFloatSetting(“ExposureTimeAbs“ value); }
}
public override int Gain
{
get { return (int)GetIntegerSetting(“GainRaw“); }
set { _gain = value; SetIntegerSetting(“GainRaw“ value); }
}
public override Hobject Image
{
get { return _image; }
}
public override bool IsConn
{
get { return _isConn; }
}
public override HWindowControl Halconwin
{
set { _halconwin = value; }
}
public override Bitmap BitMap
{
get { return _bitMap; }
}
public override event Action UpdateImage;
ImageProvider m_imageProvider;
public static List ListCamera()
{
Pylon.Initialize();
List cameraList = DeviceEnumerator.EnumerateDevices();
List nameList = new List();
foreach (DeviceEnumerator.Device device in cameraList)
{
nameList.Add(device.Name);
}
return nameList;
}
public BaslerCamera(string camerName)
{
try
{
_cameraName = camerName;
m_imageProvider = new ImageProvider();
m_imageProvider.ImageReadyEvent += new ImageProvider.ImageReadyEventHandler(ImageProcess);
m_imageProvider.DeviceRemovedEvent += new ImageProvider.DeviceRemovedEventHandler(CameraRemovedEvent);
HOperatorSet.GenEmptyObj(out _image);
}
catch (Exception e)
{
throw AldiExceptionFactory.GetException(“13000001“ “相机【“ + _cameraName + “】初始化失败“ + e.Message);
}
}
///
/// 打开相机
///
public override void Connect()
{
try
{
Pylon.Initialize();
List list = DeviceEnumerator.EnumerateDevices();
foreach (DeviceEnumerator.Device device in list)
{
if (device.Name == _cameraName)
{
if (!m_imageProvider.IsOpen)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 144 2018-03-13 14:29 相机封装库\WindowsFormsApplication16\app.config
文件 11158 2018-03-14 10:44 相机封装库\WindowsFormsApplication16\BaslerCamera.cs
文件 14336 2018-03-13 13:54 相机封装库\WindowsFormsApplication16\bin\Debug\COM.Aiscent.ALDI.Camera.dll
文件 36352 2018-03-13 13:54 相机封装库\WindowsFormsApplication16\bin\Debug\COM.Aiscent.ALDI.Camera.pdb
文件 4970 2018-03-13 13:54 相机封装库\WindowsFormsApplication16\bin\Debug\COM.Aiscent.ALDI.Camera.xm
文件 5120 2018-03-13 13:53 相机封装库\WindowsFormsApplication16\bin\Debug\COM.Aiscent.ALDI.Device.dll
文件 7680 2018-03-13 13:53 相机封装库\WindowsFormsApplication16\bin\Debug\COM.Aiscent.ALDI.Device.pdb
文件 4261 2018-03-13 13:53 相机封装库\WindowsFormsApplication16\bin\Debug\COM.Aiscent.ALDI.Device.xm
文件 42496 2018-01-08 14:16 相机封装库\WindowsFormsApplication16\bin\Debug\COM.Aiscent.ALDI.Exceptions.dll
文件 32320568 2016-06-28 21:23 相机封装库\WindowsFormsApplication16\bin\Debug\halcon.dll
文件 1279544 2014-11-15 02:27 相机封装库\WindowsFormsApplication16\bin\Debug\halcondotnet.dll
文件 61952 2015-07-03 12:49 相机封装库\WindowsFormsApplication16\bin\Debug\PylonC.NET.dll
文件 210473 2015-07-03 12:49 相机封装库\WindowsFormsApplication16\bin\Debug\PylonC.NET.xm
文件 29184 2017-05-15 13:35 相机封装库\WindowsFormsApplication16\bin\Debug\PylonC.NETSupportLibrary.dll
文件 34304 2018-03-14 11:24 相机封装库\WindowsFormsApplication16\bin\Debug\WindowsFormsApplication16.exe
文件 144 2018-03-13 14:29 相机封装库\WindowsFormsApplication16\bin\Debug\WindowsFormsApplication16.exe.config
文件 54784 2018-03-14 11:24 相机封装库\WindowsFormsApplication16\bin\Debug\WindowsFormsApplication16.pdb
文件 11600 2018-03-14 13:38 相机封装库\WindowsFormsApplication16\bin\Debug\WindowsFormsApplication16.vshost.exe
文件 144 2018-03-13 14:29 相机封装库\WindowsFormsApplication16\bin\Debug\WindowsFormsApplication16.vshost.exe.config
文件 490 2010-03-17 22:39 相机封装库\WindowsFormsApplication16\bin\Debug\WindowsFormsApplication16.vshost.exe.manifest
文件 2855 2018-03-13 17:32 相机封装库\WindowsFormsApplication16\BitmapFactory.cs
文件 2905 2018-03-13 17:54 相机封装库\WindowsFormsApplication16\Camera.cs
文件 1265 2018-03-13 16:28 相机封装库\WindowsFormsApplication16\CameraFactory.cs
文件 3360 2018-03-14 11:24 相机封装库\WindowsFormsApplication16\Form1.cs
文件 12576 2018-03-14 10:35 相机封装库\WindowsFormsApplication16\Form1.Designer.cs
文件 20312 2018-03-14 10:35 相机封装库\WindowsFormsApplication16\Form1.resx
文件 15151 2018-03-13 15:41 相机封装库\WindowsFormsApplication16\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
文件 7255 2018-03-14 13:40 相机封装库\WindowsFormsApplication16\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 4608 2018-03-13 14:29 相机封装库\WindowsFormsApplication16\obj\x86\Debug\TempPE\Properties.Resources.Designer.cs.dll
文件 10255 2018-03-14 10:35 相机封装库\WindowsFormsApplication16\obj\x86\Debug\WindowsFormsApplication16.cameraForm.resources
............此处省略27个文件信息
- 上一篇:ASP.NET 在线考试系统
- 下一篇:数据库《学生信息管理系统》课程设计
评论
共有 条评论