ringbuffer and statistics
This commit is contained in:
@@ -20,12 +20,12 @@ public class CameraSettings : ISettings
|
||||
|
||||
}
|
||||
|
||||
public EImageSource Camera1Source { get; set; }
|
||||
public string Camera1Label { get; set; }
|
||||
public EImageSource CameraSource { get; set; }
|
||||
public string CameraLabel { get; set; }
|
||||
|
||||
public void RegisterSettings(InspectronSettings settings)
|
||||
{
|
||||
settings.RegisterSimple(this, () => this.Camera1Source, CameraName, "Image source");
|
||||
settings.RegisterSimple(this, () => this.Camera1Label, CameraName, "Label");
|
||||
settings.RegisterSimple(this, () => this.CameraSource, CameraName, "Image source");
|
||||
settings.RegisterSimple(this, () => this.CameraLabel, CameraName, "Label");
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using Inspectron.Settings;
|
||||
using Ninject;
|
||||
using Ninject.Extensions.ChildKernel;
|
||||
|
||||
namespace VisionBuilder.UI.Common;
|
||||
|
||||
@@ -14,6 +15,29 @@ public static class Extensions
|
||||
{
|
||||
settingsInstance.RegisterSettings(self.Get<InspectronSettings>());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void RegisterModule<T>(this IKernel self) where T : IVisionBuilderModule
|
||||
{
|
||||
self.Bind<T, IVisionBuilderModule>().To<T>().InSingletonScope();
|
||||
}
|
||||
|
||||
public static void InitializeModules(this IKernel self)
|
||||
{
|
||||
|
||||
var serviceTypes = self.GetAll(typeof(IVisionBuilderModule)).Select(x => (IVisionBuilderModule)x).ToList();
|
||||
foreach (var service in serviceTypes)
|
||||
{
|
||||
if (service != null)
|
||||
{
|
||||
service.InitializeModule();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
6
VisionBuilder.UI.Common/IVisionBuilderModule.cs
Normal file
6
VisionBuilder.UI.Common/IVisionBuilderModule.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace VisionBuilder.UI.Common;
|
||||
|
||||
public interface IVisionBuilderModule
|
||||
{
|
||||
public void InitializeModule();
|
||||
}
|
||||
@@ -1,7 +1,32 @@
|
||||
namespace VisionBuilder.UI.Common;
|
||||
namespace Lindt.Colorballs.Duo.Utils;
|
||||
|
||||
public static class PathSettingsUtils
|
||||
{
|
||||
public const string INSTUCTIONS = @"
|
||||
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_NUM - number of the month of the image
|
||||
$MONTH_NAME - name of the 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_NUM - number of the month of the session start
|
||||
$SS_MONTH_NAME - name of the month of the session start
|
||||
$SS_YEAR - year of the session start";
|
||||
public static string ConvertVariables(
|
||||
string text,
|
||||
DateTime imageTime,
|
||||
@@ -25,7 +50,8 @@ public static class PathSettingsUtils
|
||||
["$MS"] = imageTime.Millisecond.ToString("D3"),
|
||||
|
||||
["$DAY"] = imageTime.Day.ToString("D2"),
|
||||
["$MONTH"] = imageTime.Month.ToString("D2"),
|
||||
["$MONTH_NUM"] = imageTime.Month.ToString("D2"),
|
||||
["$MONTH_NAME"] = imageTime.ToString("MMMM"),
|
||||
["$YEAR"] = imageTime.Year.ToString(),
|
||||
|
||||
["$SS_HOUR"] = sessionTime.Hour.ToString("D2"),
|
||||
@@ -33,7 +59,8 @@ public static class PathSettingsUtils
|
||||
["$SS_SECOND"] = sessionTime.Second.ToString("D2"),
|
||||
|
||||
["$SS_DAY"] = sessionTime.Day.ToString("D2"),
|
||||
["$SS_MONTH"] = sessionTime.ToString("MMMM"),
|
||||
["$SS_MONTH_NUM"] = sessionTime.Month.ToString("D2"),
|
||||
["$SS_MONTH_NAME"] = sessionTime.ToString("MMMM"),
|
||||
["$SS_YEAR"] = sessionTime.Year.ToString()
|
||||
};
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace VisionBuilder.UI.Common
|
||||
[NotifyCanExecuteChangedFor(nameof(StopCommand))]
|
||||
private bool _isRunning;
|
||||
[ObservableProperty]
|
||||
private string _cameraName;
|
||||
private string _cameraLabel;
|
||||
|
||||
|
||||
public bool CanStop => IsRunning;
|
||||
@@ -56,7 +56,7 @@ namespace VisionBuilder.UI.Common
|
||||
StatisticsVm = new StatisticsVM();
|
||||
PreviewVm = new PreviewVM();
|
||||
|
||||
CameraName = cameraSettings.CameraName;
|
||||
CameraLabel = cameraSettings.CameraLabel;
|
||||
|
||||
recognitionControl.ImageProcessed += Handle;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||
<PackageReference Include="Ninject" Version="3.3.6" />
|
||||
<PackageReference Include="Ninject.Extensions.ChildKernel" Version="3.3.0" />
|
||||
<PackageReference Include="OpenCvSharp4" Version="4.6.0.20220608" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
23
VisionBuilder.UI.Common/VisionBuilder.cs
Normal file
23
VisionBuilder.UI.Common/VisionBuilder.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Inspectron.Settings;
|
||||
using Ninject;
|
||||
using Ninject.Extensions.ChildKernel;
|
||||
using VisionBuilder.UI.Common.ViewModel.Interfaces.UI;
|
||||
|
||||
namespace VisionBuilder.UI.Common;
|
||||
|
||||
public static class VisionBuilder
|
||||
{
|
||||
public static IKernel CreateMainKernel(InspectronSettings settings)
|
||||
{
|
||||
StandardKernel mainKernel = new StandardKernel();
|
||||
|
||||
// GLOBAL SETTINGS //
|
||||
mainKernel.Bind<InspectronSettings>().ToConstant(settings);
|
||||
mainKernel.Bind<UIConfiguration, ISettings>().ToConstant(new UIConfiguration());
|
||||
mainKernel.Bind<ILearningTool>().To<NoLearning>().InSingletonScope();
|
||||
// --- //
|
||||
|
||||
return mainKernel;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user