111 lines
3.8 KiB
C#
111 lines
3.8 KiB
C#
using System.ComponentModel;
|
||
using DH.Commons.Enums;
|
||
using DVPCameraType;
|
||
using OpenCvSharp;
|
||
|
||
namespace DH.Devices.Camera
|
||
{
|
||
public class CameraBase
|
||
{
|
||
public volatile int SnapshotCount = 0;
|
||
[Category("采图模式")]
|
||
[Description("是否连续模式。true:连续模式采图;false:触发模式采图")]
|
||
[DisplayName("连续模式")]
|
||
public bool IsContinueMode { get; set; } = false;
|
||
|
||
[Category("采图模式")]
|
||
[Description("是否硬触发模式。true:硬触发;false:软触发")]
|
||
[DisplayName("硬触发")]
|
||
public bool IsHardwareTrigger { get; set; } = false;
|
||
|
||
public string SerialNumber { get; set; } = string.Empty;
|
||
public string CameraName { get; set; } = string.Empty;
|
||
|
||
public string CameraIP { get; set; } = string.Empty;
|
||
|
||
public string ComputerIP { get; set; } = string.Empty;
|
||
|
||
// public StreamFormat dvpStreamFormat = dvpStreamFormat.;
|
||
public dvpStreamFormat dvpStreamFormat = dvpStreamFormat.S_RGB24;
|
||
[Category("采图模式")]
|
||
[Description("是否传感器直接硬触发。true:传感器硬触发,不通过软件触发;false:通过软件触发IO 的硬触发模式")]
|
||
[DisplayName("是否传感器直接硬触发")]
|
||
public bool IsDirectHardwareTrigger { get; set; } = false;
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// 增益
|
||
/// </summary>
|
||
[Category("相机设置")]
|
||
[DisplayName("增益")]
|
||
[Description("Gain:增益,-1:不设置,不同型号相机的增益,请参考mvs")]
|
||
public float Gain { get; set; } = -1;
|
||
|
||
[Category("图像旋转")]
|
||
[Description("默认旋转,相机开启后默认不旋转")]
|
||
[DisplayName("默认旋转")]
|
||
public virtual float RotateImage { get; set; } = 0;
|
||
|
||
|
||
|
||
[Category("相机设置")]
|
||
[DisplayName("硬触发后的延迟")]
|
||
[Description("TriggerDelay:硬触发后的延迟,单位:us 微秒")]
|
||
public float TriggerDelay { get; set; } = 0;
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// 滤波时间
|
||
/// </summary>
|
||
[Category("相机设置")]
|
||
[DisplayName("滤波时间")]
|
||
[Description("LineDebouncerTime:I/O去抖时间 单位:us")]
|
||
public int LineDebouncerTime { get; set; } = 0;
|
||
|
||
|
||
|
||
public Action<DateTime, CameraBase, Mat> OnHImageOutput { get; set; }
|
||
/// <summary>
|
||
/// 相机连接
|
||
/// </summary>
|
||
/// <returns>是否成功</returns>
|
||
public virtual bool CameraConnect() { return false; }
|
||
|
||
/// <summary>
|
||
/// 相机断开
|
||
/// </summary>
|
||
/// <returns>是否成功</returns>
|
||
public virtual bool CameraDisConnect() { return false; }
|
||
|
||
/// <summary>
|
||
/// 抓取一张图像
|
||
/// </summary>
|
||
/// <returns>图像</returns>
|
||
//internal virtual HObject GrabOneImage(string cameraName) { return null; }
|
||
/// <summary>
|
||
/// 设置曝光时间
|
||
/// </summary>
|
||
/// <param name="exposureTime">曝光时间</param>
|
||
public virtual void SetExposure(int exposureTime, string cameraName) { }
|
||
/// <summary>
|
||
/// 设置增益
|
||
/// </summary>
|
||
/// <param name="exposure">增益</param>
|
||
public virtual void SetGain(int gain, string cameraName) { }
|
||
/// <summary>
|
||
/// 设置采集模式
|
||
/// </summary>
|
||
/// <param name="mode">0=连续采集,即异步采集 1=单次采集,即同步采集</param>
|
||
internal virtual void SetAcquisitionMode(int mode) { }
|
||
/// <summary>
|
||
/// 设置采集图像的ROI
|
||
/// </summary>
|
||
internal virtual void SetAcqRegion(int offsetV, int offsetH, int imageH, int imageW, string cameraName) { }
|
||
|
||
|
||
|
||
}
|
||
}
|