C3032
2025-12-20 ae0d9092bc828a5260c4f506c976c32b7bb2feab
优化相机设置和异常处理逻辑

在 `2DCameraForm.cs` 中,注释掉了相机连接和断开按钮的禁用代码,并添加了对 `btnEdit` 按钮的启用逻辑。新增 `CameraAdvancedSettings` 类,封装相机高级设置,更新相机配置保存逻辑,确保使用实际的触发源和极性值。

在 `HRCamera.cs` 中,管理相机句柄创建状态,更新增益设置逻辑,增加触发极性、滤波、延时和信号线状态的设置与获取方法,移除未实现的抽象方法,提供完整功能实现。

增加异常处理和日志记录,提升调试和排查能力。
已修改2个文件
530 ■■■■ 文件已修改
LB_VisionProcesses/Cameras/2DCameraForm.cs 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_VisionProcesses/Cameras/HRCamera.cs 427 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_VisionProcesses/Cameras/2DCameraForm.cs
@@ -37,9 +37,9 @@
        {
            InitializeComponent();
            //传入相机句柄后禁用连接/断开按键
            this.btnOpen.Enabled = false;
            this.btnClose.Enabled = false;
            this.cmbBrand.Enabled = false;
            //this.btnOpen.Enabled = false;
            //this.btnClose.Enabled = false;
            //this.cmbBrand.Enabled = false;
            this.panel_Picture.Controls.Clear();
            this.dicCameras = dicCameras;
@@ -203,6 +203,7 @@
                int Index = cmbBrand.FindString(camera.Brand.ToString()); ;
                cmbBrand.Text = camera.Brand.ToString();
                cmbBrand.SelectedIndex = Index;
                this.btnEdit.Enabled = true;
            }
        }
@@ -236,6 +237,7 @@
                    camera.ImageGrabbed -= GetImageBllComplete;
                    camera.ImageGrabbed += GetImageBllComplete;
                    MessageBox.Show(camera.SN + "打开成功");
                    this.btnEdit.Enabled = true;
                }
            }
            else
@@ -282,6 +284,67 @@
        {
            if (camera == null)
                return;
            using (Form editForm = new Form())
            {
                editForm.Text = "高级参数设置 - " + camera.SN;
                editForm.Size = new System.Drawing.Size(400, 500);
                editForm.StartPosition = FormStartPosition.CenterParent;
                editForm.FormBorderStyle = FormBorderStyle.SizableToolWindow;
                PropertyGrid pg = new PropertyGrid();
                pg.Dock = DockStyle.Fill;
                pg.SelectedObject = new CameraAdvancedSettings(camera);
                editForm.Controls.Add(pg);
                editForm.ShowDialog();
            }
        }
        /// <summary>
        /// 相机高级设置包装类
        /// </summary>
        public class CameraAdvancedSettings
        {
            private BaseCamera _camera;
            public CameraAdvancedSettings(BaseCamera camera)
            {
                _camera = camera;
            }
            [System.ComponentModel.Category("触发设置"), System.ComponentModel.Description("触发源")]
            public TriggerSource TriggerSource
            {
                get { _camera.GetTriggerMode(out _, out TriggerSource s); return s; }
                set { _camera.GetTriggerMode(out TriggerMode m, out _); _camera.SetTriggerMode(m, value); }
            }
            [System.ComponentModel.Category("触发设置"), System.ComponentModel.Description("触发极性")]
            public TriggerPolarity TriggerPolarity
            {
                get { _camera.GetTriggerPolarity(out TriggerPolarity p); return p; }
                set { _camera.SetTriggerPolarity(value); }
            }
            [System.ComponentModel.Category("触发设置"), System.ComponentModel.Description("触发延时(us)")]
            public double TriggerDelay
            {
                get { _camera.GetTriggerDelay(out double d); return d; }
                set { _camera.SetTriggerDelay(value); }
            }
            [System.ComponentModel.Category("触发设置"), System.ComponentModel.Description("触发滤波(us)")]
            public double TriggerFilter
            {
                get { _camera.GetTriggerFliter(out double f); return f; }
                set { _camera.SetTriggerFliter(value); }
            }
            [System.ComponentModel.Category("图像设置"), System.ComponentModel.Description("自动白平衡")]
            public void AutoBalanceWhite()
            {
                _camera.AutoBalanceWhite();
            }
        }
        /// <summary>
@@ -516,9 +579,25 @@
            if (res == DialogResult.Yes)  //保存VPP
            {
                TriggerSource actualSource = TriggerSource.Line0;
                TriggerPolarity polarity = TriggerPolarity.RisingEdge;
                double delay = 0;
                double filter = 0;
                if (camera != null)
                {
                    camera.GetTriggerMode(out _, out actualSource);
                    camera.GetTriggerPolarity(out polarity);
                    camera.GetTriggerDelay(out delay);
                    camera.GetTriggerFliter(out filter);
                }
                camConfig.Params.Inputs.Add("相机SN", cmbSN.Text);
                camConfig.Params.Inputs.Add("触发模式", TriggerMode.On);
                camConfig.Params.Inputs.Add("触发方式", radioButtonSoft.Checked ? TriggerSource.Software : TriggerSource.Line0);
                camConfig.Params.Inputs.Add("触发方式", radioButtonSoft.Checked ? TriggerSource.Software : actualSource);
                camConfig.Params.Inputs.Add("触发极性", polarity);
                camConfig.Params.Inputs.Add("触发延时", delay);
                camConfig.Params.Inputs.Add("触发消抖", filter);
                camConfig.Params.Inputs.Add("是否本地取图", ckbLocalTest.Checked);
                camConfig.Params.Inputs.Add("本地取图路径", cmbImagesPath.Items.Cast<string>().ToList());
                camConfig.Params.Inputs.Add("是否失败重新取图", ckbRegrab.Checked);
@@ -547,10 +626,11 @@
                camera.ImageGrabbed -= GetImageBllComplete;
                camera.StopGrabbing();
                camera.GetTriggerMode(out _, out TriggerSource actualSource);
                if (radioButtonSoft.Checked)
                    camera.SetTriggerMode(TriggerMode.On, TriggerSource.Software);
                else
                    camera.SetTriggerMode(TriggerMode.On, TriggerSource.Line0);
                    camera.SetTriggerMode(TriggerMode.On, actualSource);
                camera.StartGrabbing();
            }
@@ -620,10 +700,21 @@
            if (camera == null)
                return;
            camera.GetTriggerMode(out _, out TriggerSource currentSource);
            if (radioButtonSoft.Checked)
            {
                camera.SetTriggerMode(TriggerMode.On, TriggerSource.Software);
            }
            else
                camera.SetTriggerMode(TriggerMode.On, TriggerSource.Line0);
            {
                // 如果当前已经是硬件触发源,则保持;否则默认Line0
                if (currentSource == TriggerSource.Software)
                    camera.SetTriggerMode(TriggerMode.On, TriggerSource.Line0);
                else
                    camera.SetTriggerMode(TriggerMode.On, currentSource);
            }
        }
        System.Windows.Forms.ToolTip ToolTip = new System.Windows.Forms.ToolTip();
LB_VisionProcesses/Cameras/HRCamera.cs
@@ -1,6 +1,7 @@
using MVSDK_Net;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
@@ -22,6 +23,7 @@
        private Thread _grabThread; // 图像采集线程
        private bool _isGrabbing; // 采集状态标志
        private bool _threadRunning; // 线程运行标志
        private bool _handleCreated = false; // 句柄是否已创建
        private Thread _callbackThread; // 回调处理线程
        private List<IMVDefine.IMV_Frame> _frameList; // 图像缓存列表
        private readonly object _frameLock = new object(); // 帧缓存锁
@@ -90,7 +92,8 @@
                else
                {
                    // 记录日志或抛出异常
                    throw new Exception($"枚举设备失败,错误码:{result}");
                    //throw new Exception($"枚举设备失败,错误码:{result}");
                    Debug.WriteLine("枚举设备失败!");
                }
            }
            catch (Exception ex)
@@ -113,10 +116,19 @@
        {
            try
            {
                // 如果相机已打开,先关闭
                if (_camera != null && _camera.IMV_IsOpen())
                // 确保彻底关闭和清理
                if (_camera != null)
                {
                    CloseDevice();
                    if (_camera.IMV_IsOpen())
                    {
                        _camera.IMV_Close();
                    }
                    if (_handleCreated)
                    {
                        _camera.IMV_DestroyHandle();
                        _handleCreated = false;
                    }
                }
                
                // 枚举设备并匹配SN
@@ -143,6 +155,7 @@
                {
                    throw new Exception($"创建设备句柄失败,错误码:{result}");
                }
                _handleCreated = true;
                
                // 打开设备
                result = _camera.IMV_Open();
@@ -152,7 +165,7 @@
                }
                
                // 设置设备属性
                SN = SN;
                this.SN = SN;
                isGrabbing = false;
                
                // 设置缓存个数为8
@@ -192,6 +205,13 @@
                    {
                        System.Diagnostics.Debug.WriteLine($"关闭相机失败,错误码:{result}");
                    }
                }
                // 销毁句柄
                if (_handleCreated)
                {
                    _camera.IMV_DestroyHandle();
                    _handleCreated = false;
                }
                
                // 释放资源
@@ -519,27 +539,27 @@
                    throw new Exception("相机未打开");
                }
                
                string gainFeature = _camera.IMV_FeatureIsValid("Gain") ? "Gain" : "GainRaw";
                // 验证增益范围
                double minGain = 0, maxGain = 0;
                int result = _camera.IMV_GetDoubleFeatureMin("GainRaw", ref minGain);
                int result = _camera.IMV_GetDoubleFeatureMin(gainFeature, ref minGain);
                if (result != IMVDefine.IMV_OK)
                {
                    throw new Exception($"获取增益最小值失败,错误码:{result}");
                }
                
                result = _camera.IMV_GetDoubleFeatureMax("GainRaw", ref maxGain);
                result = _camera.IMV_GetDoubleFeatureMax(gainFeature, ref maxGain);
                if (result != IMVDefine.IMV_OK)
                {
                    throw new Exception($"获取增益最大值失败,错误码:{result}");
                }
                
                if (gain < minGain || gain > maxGain)
                {
                    throw new Exception($"增益值超出范围,有效范围:{minGain} - {maxGain}");
                }
                if (gain < minGain) gain = minGain;
                if (gain > maxGain) gain = maxGain;
                
                // 设置增益
                result = _camera.IMV_SetDoubleFeatureValue("GainRaw", gain);
                result = _camera.IMV_SetDoubleFeatureValue(gainFeature, gain);
                if (result != IMVDefine.IMV_OK)
                {
                    throw new Exception($"设置增益失败,错误码:{result}");
@@ -570,7 +590,8 @@
                    throw new Exception("相机未打开");
                }
                
                int result = _camera.IMV_GetDoubleFeatureValue("GainRaw", ref gain);
                string gainFeature = _camera.IMV_FeatureIsValid("Gain") ? "Gain" : "GainRaw";
                int result = _camera.IMV_GetDoubleFeatureValue(gainFeature, ref gain);
                return result == IMVDefine.IMV_OK;
            }
            catch (Exception ex)
@@ -580,32 +601,278 @@
            }
        }
        
        // 其他参数设置方法类似,这里省略部分实现...
        /// <summary>
        /// 设置触发极性
        /// </summary>
        /// <param name="polarity">触发极性</param>
        /// <returns>是否成功</returns>
        public override bool SetTriggerPolarity(TriggerPolarity polarity)
        {
            try
            {
                if (_camera == null || !_camera.IMV_IsOpen()) return false;
                string activation = (polarity == TriggerPolarity.RisingEdge || polarity == TriggerPolarity.HighLevel)
                    ? "RisingEdge" : "FallingEdge";
                int result = _camera.IMV_SetEnumFeatureSymbol("TriggerActivation", activation);
                return result == IMVDefine.IMV_OK;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine($"设置触发极性失败:{ex.Message}");
                return false;
            }
        }
        /// <summary>
        /// 获取触发极性
        /// </summary>
        /// <param name="polarity">触发极性</param>
        /// <returns>是否成功</returns>
        public override bool GetTriggerPolarity(out TriggerPolarity polarity)
        {
            polarity = TriggerPolarity.RisingEdge;
            try
            {
                if (_camera == null || !_camera.IMV_IsOpen()) return false;
                IMVDefine.IMV_String activation = new IMVDefine.IMV_String();
                int result = _camera.IMV_GetEnumFeatureSymbol("TriggerActivation", ref activation);
                if (result == IMVDefine.IMV_OK)
                {
                    polarity = activation.str == "RisingEdge" ? TriggerPolarity.RisingEdge : TriggerPolarity.FallingEdge;
                    return true;
                }
                return false;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine($"获取触发极性失败:{ex.Message}");
                return false;
            }
        }
        /// <summary>
        /// 设置触发滤波时间 (us)
        /// </summary>
        public override bool SetTriggerFliter(double flitertime)
        {
            try
            {
                if (_camera == null || !_camera.IMV_IsOpen()) return false;
                // 华睿相机通常使用 LineDebouncerTime 控制滤波
                if (_camera.IMV_FeatureIsValid("LineDebouncerTime"))
                {
                    int result = _camera.IMV_SetDoubleFeatureValue("LineDebouncerTime", flitertime);
                    return result == IMVDefine.IMV_OK;
                }
                return false;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine($"设置触发滤波失败:{ex.Message}");
                return false;
            }
        }
        /// <summary>
        /// 获取触发滤波时间 (us)
        /// </summary>
        public override bool GetTriggerFliter(out double flitertime)
        {
            flitertime = 0;
            try
            {
                if (_camera == null || !_camera.IMV_IsOpen()) return false;
                if (_camera.IMV_FeatureIsValid("LineDebouncerTime"))
                {
                    int result = _camera.IMV_GetDoubleFeatureValue("LineDebouncerTime", ref flitertime);
                    return result == IMVDefine.IMV_OK;
                }
                return false;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine($"获取触发滤波失败:{ex.Message}");
                return false;
            }
        }
        /// <summary>
        /// 设置触发延时 (us)
        /// </summary>
        public override bool SetTriggerDelay(double delay)
        {
            try
            {
                if (_camera == null || !_camera.IMV_IsOpen()) return false;
                if (_camera.IMV_FeatureIsValid("TriggerDelay"))
                {
                    int result = _camera.IMV_SetDoubleFeatureValue("TriggerDelay", delay);
                    return result == IMVDefine.IMV_OK;
                }
                return false;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine($"设置触发延时失败:{ex.Message}");
                return false;
            }
        }
        /// <summary>
        /// 获取触发延时 (us)
        /// </summary>
        public override bool GetTriggerDelay(out double delay)
        {
            delay = 0;
            try
            {
                if (_camera == null || !_camera.IMV_IsOpen()) return false;
                if (_camera.IMV_FeatureIsValid("TriggerDelay"))
                {
                    int result = _camera.IMV_GetDoubleFeatureValue("TriggerDelay", ref delay);
                    return result == IMVDefine.IMV_OK;
                }
                return false;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine($"获取触发延时失败:{ex.Message}");
                return false;
            }
        }
        /// <summary>
        /// 设置信号线模式
        /// </summary>
        public override bool SetLineMode(IOLines line, LineMode mode)
        {
            try
            {
                if (_camera == null || !_camera.IMV_IsOpen()) return false;
                // 选择线路
                int result = _camera.IMV_SetEnumFeatureSymbol("LineSelector", line.ToString());
                if (result != IMVDefine.IMV_OK) return false;
                // 设置模式
                string lineMode = mode == LineMode.Input ? "Input" : "Output";
                result = _camera.IMV_SetEnumFeatureSymbol("LineMode", lineMode);
                return result == IMVDefine.IMV_OK;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine($"设置信号线模式失败:{ex.Message}");
                return false;
            }
        }
        /// <summary>
        /// 设置信号线电平状态
        /// </summary>
        public override bool SetLineStatus(IOLines line, LineStatus linestatus)
        {
            try
            {
                if (_camera == null || !_camera.IMV_IsOpen()) return false;
                // 仅对输出线路有效
                int result = _camera.IMV_SetEnumFeatureSymbol("LineSelector", line.ToString());
                if (result != IMVDefine.IMV_OK) return false;
                bool status = linestatus == LineStatus.Hight;
                result = _camera.IMV_SetBoolFeatureValue("UserOutputValue", status);
                return result == IMVDefine.IMV_OK;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine($"设置信号线状态失败:{ex.Message}");
                return false;
            }
        }
        /// <summary>
        /// 获取信号线电平状态
        /// </summary>
        public override bool GetLineStatus(IOLines line, out LineStatus lineStatus)
        {
            lineStatus = LineStatus.Low;
            try
            {
                if (_camera == null || !_camera.IMV_IsOpen()) return false;
                int result = _camera.IMV_SetEnumFeatureSymbol("LineSelector", line.ToString());
                if (result != IMVDefine.IMV_OK) return false;
                bool status = false;
                result = _camera.IMV_GetBoolFeatureValue("LineStatus", ref status);
                if (result == IMVDefine.IMV_OK)
                {
                    lineStatus = status ? LineStatus.Hight : LineStatus.Low;
                    return true;
                }
                return false;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine($"获取信号线状态失败:{ex.Message}");
                return false;
            }
        }
        /// <summary>
        /// 自动白平衡
        /// </summary>
        public override bool AutoBalanceWhite()
        {
            try
            {
                if (_camera == null || !_camera.IMV_IsOpen()) return false;
                if (_camera.IMV_FeatureIsValid("BalanceWhiteAuto"))
                {
                    int result = _camera.IMV_SetEnumFeatureSymbol("BalanceWhiteAuto", "Once");
                    return result == IMVDefine.IMV_OK;
                }
                return false;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine($"自动白平衡失败:{ex.Message}");
                return false;
            }
        }
        #endregion
        #region 辅助方法
        #region 采集和转换辅助方法
        /// <summary>
        /// 图像采集线程处理函数
        /// </summary>
        private void GrabThreadProc()
        {
            IMVDefine.IMV_Frame frame = new IMVDefine.IMV_Frame();
            while (_threadRunning)
            {
                try
                {
                    // 获取图像帧
                    int result = _camera.IMV_GetFrame(ref frame, 100);
                    if (result == IMVDefine.IMV_OK)
                    {
                        // 处理图像帧
                        ProcessFrame(frame);
                    }
                    else if (result != 0x80000001) // 超时错误代码(常见值)
                    else if (result != 0x80000001) // 超时错误代码
                    {
                        // 非超时错误
                        System.Diagnostics.Debug.WriteLine($"获取图像帧失败,错误码:{result}");
@@ -615,11 +882,11 @@
                {
                    System.Diagnostics.Debug.WriteLine($"采集线程异常:{ex.Message}");
                }
                Thread.Sleep(1);
            }
        }
        /// <summary>
        /// 处理图像帧
        /// </summary>
@@ -630,26 +897,27 @@
            {
                // 将图像数据转换为Bitmap
                Bitmap bitmap = ConvertFrameToBitmap(frame);
                if (bitmap != null)
                {
                    // 触发图像采集事件
                    CameraEventArgs args = new CameraEventArgs(SN, bitmap);
                    ImageGrabbed?.Invoke(this, args);
                    // 更新回调图像
                    CallBackImg = bitmap;
                }
                // 释放帧
                _camera.IMV_ReleaseFrame(ref frame);
                var tempFrame = frame;
                _camera.IMV_ReleaseFrame(ref tempFrame);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine($"处理图像帧失败:{ex.Message}");
            }
        }
        /// <summary>
        /// 将图像帧转换为Bitmap
        /// </summary>
@@ -660,7 +928,7 @@
            try
            {
                Bitmap bitmap = null;
                switch (frame.frameInfo.pixelFormat)
                {
                    case IMVDefine.IMV_EPixelType.gvspPixelMono8:
@@ -674,7 +942,7 @@
                        bitmap = ConvertToBGR8(frame);
                        break;
                }
                return bitmap;
            }
            catch (Exception ex)
@@ -683,14 +951,14 @@
                return null;
            }
        }
        /// <summary>
        /// 创建Mono8格式Bitmap
        /// </summary>
        private Bitmap CreateMono8Bitmap(IMVDefine.IMV_Frame frame)
        {
            Bitmap bitmap = new Bitmap((int)frame.frameInfo.width, (int)frame.frameInfo.height, PixelFormat.Format8bppIndexed);
            // 设置灰度调色板
            ColorPalette palette = bitmap.Palette;
            for (int i = 0; i < 256; i++)
@@ -698,39 +966,39 @@
                palette.Entries[i] = Color.FromArgb(i, i, i);
            }
            bitmap.Palette = palette;
            // 复制图像数据
            BitmapData bmpData = bitmap.LockBits(
                new Rectangle(0, 0, bitmap.Width, bitmap.Height),
                ImageLockMode.WriteOnly,
                bitmap.PixelFormat);
            // 使用CopyMemory API进行内存复制
            CopyMemory(bmpData.Scan0, frame.pData, (uint)Math.Min(frame.frameInfo.size, (uint)(bmpData.Stride * bitmap.Height)));
            bitmap.UnlockBits(bmpData);
            return bitmap;
        }
        /// <summary>
        /// 创建BGR8格式Bitmap
        /// </summary>
        private Bitmap CreateBgr8Bitmap(IMVDefine.IMV_Frame frame)
        {
            Bitmap bitmap = new Bitmap((int)frame.frameInfo.width, (int)frame.frameInfo.height, PixelFormat.Format24bppRgb);
            BitmapData bmpData = bitmap.LockBits(
                new Rectangle(0, 0, bitmap.Width, bitmap.Height),
                ImageLockMode.WriteOnly,
                bitmap.PixelFormat);
            // 使用CopyMemory API进行内存复制
            CopyMemory(bmpData.Scan0, frame.pData, (uint)Math.Min(frame.frameInfo.size, (uint)(bmpData.Stride * bitmap.Height)));
            bitmap.UnlockBits(bmpData);
            return bitmap;
        }
        /// <summary>
        /// 转换为BGR8格式
        /// </summary>
@@ -749,10 +1017,10 @@
                eDstPixelFormat = IMVDefine.IMV_EPixelType.gvspPixelBGR8,
                nDstBufSize = frame.frameInfo.width * frame.frameInfo.height * 3
            };
            IntPtr dstBuffer = Marshal.AllocHGlobal((int)convertParam.nDstBufSize);
            convertParam.pDstBuf = dstBuffer;
            try
            {
                int result = _camera.IMV_PixelConvert(ref convertParam);
@@ -767,26 +1035,26 @@
                Marshal.FreeHGlobal(dstBuffer);
            }
        }
        /// <summary>
        /// 从缓冲区创建BGR8 Bitmap
        /// </summary>
        private Bitmap CreateBgr8BitmapFromBuffer(IntPtr buffer, uint width, uint height)
        {
            Bitmap bitmap = new Bitmap((int)width, (int)height, PixelFormat.Format24bppRgb);
            BitmapData bmpData = bitmap.LockBits(
                new Rectangle(0, 0, bitmap.Width, bitmap.Height),
                ImageLockMode.WriteOnly,
                bitmap.PixelFormat);
            // 使用CopyMemory API进行安全的内存复制
            CopyMemory(bmpData.Scan0, buffer, (uint)(width * height * 3));
            bitmap.UnlockBits(bmpData);
            return bitmap;
        }
        /// <summary>
        /// 将触发源枚举转换为字符串
        /// </summary>
@@ -804,7 +1072,7 @@
                _ => "Software"
            };
        }
        /// <summary>
        /// 将字符串转换为触发源枚举
        /// </summary>
@@ -822,72 +1090,9 @@
                _ => TriggerSource.Software
            };
        }
        #endregion
        #region 未实现的抽象方法(简化版实现)
        public override bool SetTriggerPolarity(TriggerPolarity polarity)
        {
            // 华睿相机可能不支持该功能,返回成功
            return true;
        }
        public override bool GetTriggerPolarity(out TriggerPolarity polarity)
        {
            polarity = TriggerPolarity.RisingEdge;
            return true;
        }
        public override bool SetTriggerFliter(double flitertime)
        {
            // 暂不支持
            return true;
        }
        public override bool GetTriggerFliter(out double flitertime)
        {
            flitertime = 0;
            return true;
        }
        public override bool SetTriggerDelay(double delay)
        {
            // 暂不支持
            return true;
        }
        public override bool GetTriggerDelay(out double delay)
        {
            delay = 0;
            return true;
        }
        public override bool SetLineMode(IOLines line, LineMode mode)
        {
            // 暂不支持
            return true;
        }
        public override bool SetLineStatus(IOLines line, LineStatus linestatus)
        {
            // 暂不支持
            return true;
        }
        public override bool GetLineStatus(IOLines line, out LineStatus lineStatus)
        {
            lineStatus = LineStatus.Low;
            return true;
        }
        public override bool AutoBalanceWhite()
        {
            // 暂不支持自动白平衡
            return true;
        }
        #endregion
        #region IDisposable实现