This commit is contained in:
EugeneTes
2026-02-17 10:11:33 +01:00
parent e133942594
commit 2bac7140a4
11 changed files with 82 additions and 27 deletions

View File

@@ -30,6 +30,7 @@ namespace Inspectron.Camera.UEye
_camera = new uEye.Camera();
cameraIdx = _settings.CameraId;
System.AppDomain.CurrentDomain.ProcessExit += AppDomain_ProcessExit;
}
private void AppDomain_ProcessExit(object sender, EventArgs e)
@@ -179,10 +180,10 @@ namespace Inspectron.Camera.UEye
throw new Exception("failed to save Parameters");
}
}
public int LastAqTime { get; private set; }
private void onFrameEvent(object sender, EventArgs e)
{
try
@@ -191,13 +192,14 @@ namespace Inspectron.Camera.UEye
int s32MemId;
int active = (int)camera.Memory.GetActive(out s32MemId);
int num1 = (int)camera.Memory.Lock(s32MemId);
var sw = System.Diagnostics.Stopwatch.StartNew();
var image = this.MemoryToImage(s32MemId);
int num2 = (int)camera.Memory.Unlock(s32MemId);
sw.Stop();
LastAqTime = (int)sw.ElapsedMilliseconds;
if (!_channel.Writer.TryWrite(image))
{
Log.Warning("Image channel is full, dropping image");
}
int num2 = (int)camera.Memory.Unlock(s32MemId);
_channel.Writer.TryWrite(image);
}
catch (TaskCanceledException ex)
{
@@ -206,9 +208,6 @@ namespace Inspectron.Camera.UEye
}
}
private Channel<Mat> _channel = Channel.CreateBounded<Mat>(new BoundedChannelOptions(1)
{