예제 #1
0
 public Pipeline(BlockingCollection <Message> processingOutputQueue, UserDefinedParametersPrototypeFactory userParametersFactory)
 {
     ProcessingOutputQueue  = processingOutputQueue;
     UserParametersFactory  = userParametersFactory;
     UserParameters         = userParametersFactory.GetShallowCopy();
     IsTracking             = false;
     PlaneLocalization      = new PlaneLocalization(this);
     ChessboardLocalization = new ChessboardLocalization();
     FiguresLocalization    = new FiguresLocalization();
 }
예제 #2
0
        private void Calibration()
        {
            // if data don't arrive in 10 seconds, there is probably something wrong
            var data = Buffer.TryTake(10000);

            if (data == null)
            {
                throw new TimeoutException();
            }

            UserParameters = UserParametersFactory.GetShallowCopy();

            var inputData = new InputData(data, UserParameters);

            var planeData      = PlaneLocalization.Calibrate(inputData);
            var chessboardData = ChessboardLocalization.Calibrate(planeData, ProcessingOutputQueue);
            var figuresData    = FiguresLocalization.Calibrate(chessboardData);

            SendResultMessageToUserThread(new TrackingStartSuccessfulMessage());
        }
예제 #3
0
        private void TrackingImplementation(TrackingState trackingStateOfGame)
        {
            var data = Buffer.TryTake();

            if (data == null)
            {
                return;
            }

            UserParameters = UserParametersFactory.GetShallowCopy();
            var inputData = new InputData(data, UserParameters, trackingStateOfGame);

            var planeData      = PlaneLocalization.Track(inputData);
            var chessboardData = ChessboardLocalization.Track(planeData);
            var figuresData    = FiguresLocalization.Track(chessboardData);

            SendResultMessageToUserThread(
                new ResultMessage(
                    figuresData.ResultData.VisualisationBitmap.HorizontalFlip(),
                    figuresData.ResultData.TrackingState,
                    figuresData.ResultData.SceneDisrupted,
                    figuresData.ResultData.PointCountsOverFields)
                );
        }