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;
///
/// 增益
///
[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;
///
/// 滤波时间
///
[Category("相机设置")]
[DisplayName("滤波时间")]
[Description("LineDebouncerTime:I/O去抖时间 单位:us")]
public int LineDebouncerTime { get; set; } = 0;
public Action OnHImageOutput { get; set; }
///
/// 相机连接
///
/// 是否成功
public virtual bool CameraConnect() { return false; }
///
/// 相机断开
///
/// 是否成功
public virtual bool CameraDisConnect() { return false; }
///
/// 抓取一张图像
///
/// 图像
//internal virtual HObject GrabOneImage(string cameraName) { return null; }
///
/// 设置曝光时间
///
/// 曝光时间
public virtual void SetExposure(int exposureTime, string cameraName) { }
///
/// 设置增益
///
/// 增益
public virtual void SetGain(int gain, string cameraName) { }
///
/// 设置采集模式
///
/// 0=连续采集,即异步采集 1=单次采集,即同步采集
internal virtual void SetAcquisitionMode(int mode) { }
///
/// 设置采集图像的ROI
///
internal virtual void SetAcqRegion(int offsetV, int offsetH, int imageH, int imageW, string cameraName) { }
}
}