Example #1
0
 public MeasureService(CamService camService)
 {
     this.camService = camService;
     logger          = MainWindow.ServiceContainer.Resolve <Logger>();
     drawService     = MainWindow.ServiceContainer.Resolve <DrawService>();
     throwService    = MainWindow.ServiceContainer.Resolve <ThrowService>();
     configService   = MainWindow.ServiceContainer.Resolve <ConfigService>();
     minContourArc   = configService.Read <int>(SettingsType.MinContourArc);
     camFovAngle     = configService.Read <double>(SettingsType.CamFovAngle);
 }
 public DetectionService(DrawService drawService,
                         ConfigService configService,
                         ThrowService throwService,
                         Logger logger,
                         CamsDetectionBoard camsDetectionBoard)
 {
     this.drawService        = drawService;
     this.configService      = configService;
     this.throwService       = throwService;
     this.logger             = logger;
     this.camsDetectionBoard = camsDetectionBoard;
 }
 public DetectionService(MainWindow mainWindow,
                         DrawService drawService,
                         ConfigService configService,
                         ThrowService throwService,
                         Logger logger)
 {
     this.mainWindow    = mainWindow;
     this.drawService   = drawService;
     this.configService = configService;
     this.throwService  = throwService;
     this.logger        = logger;
 }
Example #4
0
        public CamService(CamNumber camNumber,
                          ILogger logger,
                          DrawService drawService,
                          IConfigService configService)
        {
            this.camNumber     = camNumber;
            this.logger        = logger;
            this.drawService   = drawService;
            this.configService = configService;

            var camIndex = -1;

            switch (camNumber)
            {
            case CamNumber._1:
                camIndex            = GetCamIndexById(configService.Cam1Id);
                thresholdSlider     = configService.Cam1ThresholdSliderValue;
                roiPosYSlider       = configService.Cam1RoiPosYSliderValue;
                roiHeightSlider     = configService.Cam1RoiHeightSliderValue;
                surfaceSlider       = configService.Cam1SurfaceSliderValue;
                surfaceCenterSlider = configService.Cam1SurfaceCenterSliderValue;
                camSetupPoint       = new PointF(configService.Cam1XSetupValue,
                                                 configService.Cam1YSetupValue);
                break;

            case CamNumber._2:
                camIndex            = GetCamIndexById(configService.Cam2Id);
                thresholdSlider     = configService.Cam2ThresholdSliderValue;
                roiPosYSlider       = configService.Cam2RoiPosYSliderValue;
                roiHeightSlider     = configService.Cam2RoiHeightSliderValue;
                surfaceSlider       = configService.Cam2SurfaceSliderValue;
                surfaceCenterSlider = configService.Cam2SurfaceCenterSliderValue;
                camSetupPoint       = new PointF(configService.Cam2XSetupValue,
                                                 configService.Cam2YSetupValue);
                break;

            case CamNumber._3:
                camIndex            = GetCamIndexById(configService.Cam3Id);
                thresholdSlider     = configService.Cam3ThresholdSliderValue;
                roiPosYSlider       = configService.Cam3RoiPosYSliderValue;
                roiHeightSlider     = configService.Cam3RoiHeightSliderValue;
                surfaceSlider       = configService.Cam3SurfaceSliderValue;
                surfaceCenterSlider = configService.Cam3SurfaceCenterSliderValue;
                camSetupPoint       = new PointF(configService.Cam3XSetupValue,
                                                 configService.Cam3YSetupValue);

                break;

            case CamNumber._4:
                camIndex            = GetCamIndexById(configService.Cam4Id);
                thresholdSlider     = configService.Cam4ThresholdSliderValue;
                roiPosYSlider       = configService.Cam4RoiPosYSliderValue;
                roiHeightSlider     = configService.Cam4RoiHeightSliderValue;
                surfaceSlider       = configService.Cam4SurfaceSliderValue;
                surfaceCenterSlider = configService.Cam4SurfaceCenterSliderValue;
                camSetupPoint       = new PointF(configService.Cam4XSetupValue,
                                                 configService.Cam4YSetupValue);

                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(camNumber), camNumber, null);
            }

            resolutionWidth  = configService.CamsResolutionWidth;
            resolutionHeight = configService.CamsResolutionHeight;
            smoothGauss      = configService.SmoothGaussValue;
            camFovAngle      = configService.CamsFovAngle;
            videoCapture     = new VideoCapture(camIndex, VideoCapture.API.DShow);
            videoCapture.SetCaptureProperty(CapProp.FrameWidth, resolutionWidth);
            videoCapture.SetCaptureProperty(CapProp.FrameHeight, resolutionHeight);
            var projectionCenterPoint = new PointF((float)DrawService.ProjectionFrameSide / 2,
                                                   (float)DrawService.ProjectionFrameSide / 2);

            toBullAngle = MeasureService.FindAngle(camSetupPoint, projectionCenterPoint);
        }
Example #5
0
 public ThrowService(DrawService drawService, Logger logger)
 {
     this.logger      = logger;
     this.drawService = drawService;
     rays             = new List <Ray>();
 }