修改更新界面
This commit is contained in:
130
DH.Commons.Devies/Base/CameraBase.cs
Normal file
130
DH.Commons.Devies/Base/CameraBase.cs
Normal file
@ -0,0 +1,130 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing.Imaging;
|
||||
using OpenCvSharp;
|
||||
|
||||
namespace DH.Devices.Devices
|
||||
{
|
||||
public class CameraBase
|
||||
{
|
||||
public volatile int SnapshotCount = 0;
|
||||
|
||||
public virtual bool isEnabled { get; set; } = false;
|
||||
|
||||
[Category("采图模式")]
|
||||
[Description("是否连续模式。true:连续模式采图;false:触发模式采图")]
|
||||
[DisplayName("连续模式")]
|
||||
public bool IsContinueMode { get; set; } = false;
|
||||
|
||||
|
||||
public virtual bool isSavePicEnabled { get; set; } = false;
|
||||
|
||||
|
||||
|
||||
[Category("图片保存")]
|
||||
[Description("图片保存文件夹")]
|
||||
[DisplayName("图片保存文件夹")]
|
||||
public virtual string ImageSaveDirectory { get; set; }
|
||||
|
||||
[Category("图片保存")]
|
||||
[Description("图片保存格式")]
|
||||
[DisplayName("图片保存格式")]
|
||||
public ImageFormat ImageFormat { get; set; } = ImageFormat.Jpeg;
|
||||
|
||||
[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.;
|
||||
|
||||
[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("取像配置")]
|
||||
[Description("曝光")]
|
||||
[DisplayName("曝光")]
|
||||
public virtual float Exposure { get; set; } = 200;
|
||||
|
||||
[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) { }
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
31
DH.Commons.Devies/DH.Commons.Devies.csproj
Normal file
31
DH.Commons.Devies/DH.Commons.Devies.csproj
Normal file
@ -0,0 +1,31 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Platforms>AnyCPU;X64</Platforms>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Enums\" />
|
||||
<Folder Include="Helper\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="OpenCvSharp4" Version="4.10.0.20241108" />
|
||||
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.10.0.20241108" />
|
||||
<PackageReference Include="OpenCvSharp4.runtime.win" Version="4.10.0.20241108" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="halcondotnet">
|
||||
<HintPath>..\x64\Debug\halcondotnet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="hdevenginedotnet">
|
||||
<HintPath>..\x64\Debug\hdevenginedotnet.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
Reference in New Issue
Block a user