ringbuffer and statistics
This commit is contained in:
14
VisionBuilder.UI.Ringbuffer/ModuleExtensions.cs
Normal file
14
VisionBuilder.UI.Ringbuffer/ModuleExtensions.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Ninject.Extensions.ChildKernel;
|
||||
using VisionBuilder.UI.Common;
|
||||
|
||||
namespace VisionBuilder.UI.Ringbuffer;
|
||||
|
||||
public static class ModuleExtensions
|
||||
{
|
||||
public static IChildKernel UseRingbuffer(this IChildKernel self, string cameraName)
|
||||
{
|
||||
self.Bind<VisionBuilderRingbufferSettings, ISettings>().ToConstant(new VisionBuilderRingbufferSettings(cameraName));
|
||||
self.RegisterModule<VisionBuilderRingbuffer>();
|
||||
return self;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
using Inspectron.Fastbuffer;
|
||||
using Inspectron.Fastbuffer.Filesystems;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using Lindt.Colorballs.Duo.Utils;
|
||||
using OpenCvSharp;
|
||||
using VisionBuilder.UI.Common;
|
||||
using VisionBuilder.UI.Common.Commands;
|
||||
using VisionBuilder.UI.Common.RecipeProcessing;
|
||||
|
||||
namespace Lindt.Colorballs.Duo.Utils;
|
||||
namespace VisionBuilder.UI.Ringbuffer;
|
||||
|
||||
public class VisionBuilderRingbuffer
|
||||
public class VisionBuilderRingbuffer:IVisionBuilderModule
|
||||
{
|
||||
private readonly VisionBuilderRingbufferSettings _settings;
|
||||
private readonly IRecognitionControl _recognitionControl;
|
||||
@@ -17,10 +17,13 @@ public class VisionBuilderRingbuffer
|
||||
{
|
||||
_settings = settings;
|
||||
_recognitionControl = recognitionControl;
|
||||
|
||||
}
|
||||
public void InitializeModule()
|
||||
{
|
||||
_recognitionControl.SessionStarted += _recognitionControl_SessionStarted;
|
||||
_recognitionControl.ImageProcessed += _recognitionControl_ImageProcessed;
|
||||
}
|
||||
|
||||
private void _recognitionControl_ImageProcessed(VisionBuilder.UI.Common.Commands.ImageProcessedEvent obj)
|
||||
{
|
||||
if (obj.HasError)
|
||||
@@ -124,4 +127,6 @@ public class VisionBuilderRingbuffer
|
||||
_badRingbuffers.Clear();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
using Inspectron.Settings;
|
||||
using Inspectron.Settings.Attributes;
|
||||
using System.ComponentModel;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using Lindt.Colorballs.Duo.Utils;
|
||||
using VisionBuilder.UI.Common;
|
||||
|
||||
namespace Lindt.Colorballs.Duo.Utils;
|
||||
namespace VisionBuilder.UI.Ringbuffer;
|
||||
|
||||
public class VisionBuilderRingbufferSettings : ISettings
|
||||
{
|
||||
@@ -23,48 +22,25 @@ public class VisionBuilderRingbufferSettings : ISettings
|
||||
[SettingDescription(
|
||||
@"
|
||||
Specifies directory, in which MaxBad and MaxGood are applied.
|
||||
You can use the following system variables:
|
||||
|
||||
$RECIPE_NAME - name of the current recipe
|
||||
$DEFECT_NAME - name of the current defect(for bad images)
|
||||
$CAMERA_NAME - name of the camera
|
||||
|
||||
$HOUR - hour of the image
|
||||
$MINUTE - minute of the image
|
||||
$SECOND - second of the image
|
||||
$MS - milliseconds of the image
|
||||
|
||||
$DAY - day of the image
|
||||
$MONTH - month of the image
|
||||
$YEAR - year of the image
|
||||
|
||||
$SS_HOUR - hour of the session start
|
||||
$SS_MINUTE - minute of the session start
|
||||
$SS_SECOND - second of the session start
|
||||
|
||||
$SS_DAY - day of the session start
|
||||
$SS_MONTH - month of the session start
|
||||
$SS_YEAR - year of the session start
|
||||
|
||||
"
|
||||
"+ PathSettingsUtils.INSTUCTIONS
|
||||
)]
|
||||
[SettingPreview(typeof(VisionBuilderRingbufferSettings), nameof(ImagesPathTemplatePreview))]
|
||||
public string Root { get; set; } = @"..\Data\Ringbuffer\$SS_MONTH $SS_YEAR";
|
||||
public string Root { get; set; } = @"..\Data\Ringbuffer\$SS_MONTH_NAME $SS_YEAR";
|
||||
|
||||
|
||||
|
||||
[SettingDescriptionAttribute("Specifies directory, relative to the Root")]
|
||||
[SettingDescription("Specifies directory, relative to the Root")]
|
||||
[SettingPreview(typeof(VisionBuilderRingbufferSettings), nameof(ImagesPathTemplatePreview))]
|
||||
public string GoodImagesPathTemplate { get; set; } = @"\$RECIPE_NAME";
|
||||
|
||||
[SettingDescriptionAttribute("Specifies directory, relative to the Root")]
|
||||
[SettingDescription("Specifies directory, relative to the Root")]
|
||||
[SettingPreview(typeof(VisionBuilderRingbufferSettings),nameof(ImagesPathTemplatePreview))]
|
||||
public string BadImagesPathTemplate { get; set; } =
|
||||
@"\$RECIPE_NAME\$DEFECT_NAME";
|
||||
|
||||
|
||||
[SettingPreview(typeof(VisionBuilderRingbufferSettings), nameof(ImagesPathTemplatePreview))]
|
||||
public string FilenameTemplate { get; set; } = "$YEAR-$MONTH-$DAY $HOUR-$MINUTE-$SECOND $MS";
|
||||
public string FilenameTemplate { get; set; } = "$YEAR-$MONTH_NUM-$DAY $HOUR-$MINUTE-$SECOND $MS";
|
||||
|
||||
|
||||
public void RegisterSettings(InspectronSettings settings)
|
||||
|
||||
Reference in New Issue
Block a user