92 lines
2.7 KiB
C#
92 lines
2.7 KiB
C#
using Ninject;
|
|
using Ninject.Extensions.ChildKernel;
|
|
using OpenCvSharp;
|
|
using VisionBuilder.UI.Common;
|
|
using VisionBuilder.UI.Common.Plugins;
|
|
using VisionBuilder.UI.Common.Processing;
|
|
using VisionBuilder.UI.Common.ViewModel.Classes;
|
|
|
|
namespace TestPlugin
|
|
{
|
|
|
|
public class TestGlobalPlugin:IVisionBuilderModule
|
|
{
|
|
public void InitializeModule()
|
|
{
|
|
Console.WriteLine("Global HELLO from test plugin");
|
|
}
|
|
}
|
|
|
|
public class TestCameraPlugin:IVisionBuilderModule
|
|
{
|
|
public void InitializeModule()
|
|
{
|
|
Console.WriteLine("Camera HELLO from test plugin");
|
|
}
|
|
}
|
|
public class TestPlugin: IPlugin
|
|
{
|
|
public void RegisterGlobalModules(IKernel kernel)
|
|
{
|
|
kernel.RegisterModule<TestGlobalPlugin>();
|
|
}
|
|
|
|
public void RegisterCameraModules(IKernel kernel, string cameraName)
|
|
{
|
|
kernel.RegisterModule<TestCameraPlugin>();
|
|
|
|
kernel.Bind<TestRecognitionControlSettings, ISettings>().ToConstant(new TestRecognitionControlSettings(cameraName));
|
|
kernel.Rebind<IRecognitionControl>().To<TestImageProcessingControl>().InSingletonScope();
|
|
}
|
|
}
|
|
|
|
public class TestRecognitionControlSettings : BaseRecognitionControlSettings
|
|
{
|
|
public TestRecognitionControlSettings(string cameraName) : base(cameraName)
|
|
{
|
|
}
|
|
}
|
|
|
|
public class TestImageProcessingControl : BaseRecognitionControl
|
|
{
|
|
public TestImageProcessingControl(TestRecognitionControlSettings settings, ILoadingService loadingService) : base(settings, loadingService)
|
|
{
|
|
}
|
|
|
|
public override List<RecipeData> GetRecipesData()
|
|
{
|
|
return new List<RecipeData>()
|
|
{
|
|
new RecipeData()
|
|
{
|
|
Image = new Mat(100, 100, MatType.CV_8UC3, new Scalar(0, 0, 255)),
|
|
RecipeName = "Hello"
|
|
},
|
|
new RecipeData()
|
|
{
|
|
Image = new Mat(100, 100, MatType.CV_8UC3, new Scalar(0, 0, 255)),
|
|
RecipeName = "World"
|
|
}
|
|
};
|
|
}
|
|
|
|
protected override void Initialize(RecipeData currentRecipe)
|
|
{
|
|
|
|
}
|
|
|
|
protected override void WarmUp()
|
|
{
|
|
|
|
}
|
|
|
|
protected override (Mat originalImage, Mat analysisImage, TimeSpan processingTime, TimeSpan acquisitionTime, string[] errorNames)?
|
|
ProcessImage(CancellationToken token)
|
|
{
|
|
var img = new Mat(100, 100, MatType.CV_8UC3, new Scalar(0, 0, 255));
|
|
return (img, img, TimeSpan.FromMilliseconds(10), TimeSpan.FromMilliseconds(5), new string[] { "TestError" });
|
|
|
|
}
|
|
}
|
|
}
|