Ejemplo n.º 1
0
 public Ray(CamNumber camNumber, PointF camPoint, PointF rayPoint, double contourArea)
 {
     CamNumber   = camNumber;
     CamPoint    = camPoint;
     RayPoint    = rayPoint;
     ContourArea = contourArea;
 }
Ejemplo n.º 2
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);
        }