• 大小: 1.21MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-08-09
  • 语言: C#
  • 标签: c#  Basler  SDK  代码  

资源简介

c#64位basler相机SDK,与Basler工程师确认,可通用USB3.0和以太网口,双相机Demo,增加掉线重连功能。

资源截图

代码片段和文件信息

/*
 * Target:此Demo是基于Pylon5版本的开发库basler.pylon.dll所写,支持黑白/彩色的Gige/USB3.0相机。
 * Author:Jogan (MVLZ)
 * Update:2017.12.27
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

using System.Windows.Forms;
using System.Diagnostics;
using System.Runtime.InteropServices;
using Basler.Pylon;
using HalconDotNet;

namespace PylonLiveViewer
{
    public class BaslerCam
    {
        private Camera camera = null;
        private PixelDataConverter converter = new PixelDataConverter();
        private String strUserID = null;

        public long imageWidth = 0;         // 图像宽
        public long imageHeight = 0;        // 图像高
        public long minExposureTime = 0;    // 最小曝光时间
        public long maxExposureTime = 0;    // 最大曝光时间
        public long minGain = 0;            // 最小增益
        public long maxGain = 0;            // 最大增益

        private long grabTime = 0;          // 采集图像时间

        private Hobject hPylonImage = null;
        private IntPtr latestframeAddress = IntPtr.Zero;
        private Stopwatch stopWatch = new Stopwatch();

        /// 
        /// 计算采集图像时间自定义委托
        /// 

        /// 采集图像时间
        public delegate void delegateComputeGrabTime(long time);
        /// 
        /// 计算采集图像时间委托事件
        /// 

        public event delegateComputeGrabTime eventComputeGrabTime;

        /// 
        /// 图像处理自定义委托
        /// 

        /// halcon图像变量
        public delegate void delegateProcessHImage(Hobject hImage);  
        /// 
        /// 图像处理委托事件
        /// 

        public event delegateProcessHImage eventProcessImage;

        /// 
        /// if >= Sfnc2_0_0说明是USB3的相机
        /// 

        static Version Sfnc2_0_0 = new Version(2 0 0);


/******************    实例化相机    ******************/
        /// 
        /// 实例化第一个找到的相机
        /// 

        public BaslerCam()
        {
            try
            {
                camera = new Camera();
            }
            catch (Exception e)
            {
                ShowException(e);
            }
        }

        /// 
        /// 根据相机序列号实例化相机
        /// 

        /// 
        //public BaslerCam(string SN)
        //{
        //    camera = new Camera(SN);
        //}

        /// 
        /// 根据相机UserID实例化相机
        /// 

        /// 
        public BaslerCam(string UserID)
        {
            try
            {
                strUserID = UserID;     //掉线重连用

                // 枚举相机列表
                List allCameraInfos = CameraFinder.Enumerate();

                foreach (ICameraInfo cameraInfo in allCameraInfos)
    

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-06-21 17:23  C#_x64_Pylon5(增加掉线重连)\
     目录           0  2017-12-27 17:38  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\
     目录           0  2018-06-21 17:23  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\
     目录           0  2018-06-22 11:48  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\
     文件        1241  2017-08-12 10:04  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer.sln
     文件       38912  2017-12-27 17:41  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer.suo
     文件       74240  2018-06-22 11:48  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer.v12.suo
     文件         144  2017-11-24 14:03  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\app.config
     文件       32038  2016-07-20 14:59  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\Basler.ico
     文件       33722  2017-12-27 17:41  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\BaslerCam.cs
     目录           0  2017-08-12 10:04  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\bin\
     目录           0  2017-08-12 09:29  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\bin\Debug\
     文件       11600  2017-08-12 09:29  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\bin\Debug\PylonLiveViewer.vshost.exe
     文件         490  2017-03-19 05:00  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\bin\Debug\PylonLiveViewer.vshost.exe.manifest
     目录           0  2017-08-12 10:04  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\bin\Release\
     目录           0  2017-08-12 10:13  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\bin\x64\
     目录           0  2017-12-27 16:52  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\bin\x64\Debug\
     文件     1271352  2014-11-15 02:27  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\bin\x64\Debug\halcondotnet.dll
     文件     3054227  2010-09-15 01:04  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\bin\x64\Debug\halcondotnet.xml
     文件       68096  2018-06-22 11:40  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\bin\x64\Debug\PylonLiveViewer.exe
     文件         144  2017-11-24 14:03  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\bin\x64\Debug\PylonLiveViewer.exe.config
     文件       69120  2018-06-22 11:40  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\bin\x64\Debug\PylonLiveViewer.pdb
     文件       24216  2018-06-22 11:41  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\bin\x64\Debug\PylonLiveViewer.vshost.exe
     文件         144  2017-11-24 14:03  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\bin\x64\Debug\PylonLiveViewer.vshost.exe.config
     文件         490  2018-04-12 07:35  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\bin\x64\Debug\PylonLiveViewer.vshost.exe.manifest
     目录           0  2017-08-15 20:17  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\bin\x64\Release\
     文件      850168  2010-09-23 17:42  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\bin\x64\Release\halcondotnet.dll
     文件     3054227  2010-09-15 01:04  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\bin\x64\Release\halcondotnet.xml
     文件       32256  2017-08-15 20:17  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\bin\x64\Release\PylonLiveViewer.exe
     文件       48640  2017-08-15 20:17  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\bin\x64\Release\PylonLiveViewer.pdb
     文件       11592  2017-08-16 19:56  C#_x64_Pylon5(增加掉线重连)\C#_x64_Pylon5_Halcon10_VS2010_2CCD_V3.5.0\PylonLiveViewer\PylonLiveViewer\bin\x64\Release\PylonLiveViewer.vshost.exe
............此处省略45个文件信息

评论

共有 条评论