Пример #1
0
        public Snapshot(StereoImage stereoImage, EyeWeb eyeWeb, int centerX, int centerY)
        {
            EyeWeb = eyeWeb;
            int resolution     = eyeWeb.Resolution;
            int halfResolution = resolution / 2;
            int left           = centerX - halfResolution;
            int top            = centerY - halfResolution;

            Parallel.For(0, 3, i =>
            {
                switch (i)
                {
                case 0:
                    Left = eyeWeb.GetSnapshot(stereoImage.Left.GetIntensities(left, top, resolution, resolution), true, false);
                    break;

                case 1:
                    Mono = eyeWeb.GetSnapshot(stereoImage.Mono.GetIntensities(left, top, resolution, resolution), false, false);
                    break;

                case 2:
                    Right = eyeWeb.GetSnapshot(stereoImage.Right.GetIntensities(left, top, resolution, resolution), false, true);
                    break;
                }
            });
            size = eyeWeb.shapes.Count;
        }
Пример #2
0
        private void SetImage(Image newImage)
        {
            Image dispose = ThreadControlCenter.Main.OriginalImage;

            GrayscaleImageData grayscaleImageData = new GrayscaleImageData(newImage);
            StereoImage        stereoImage        = new StereoImage(grayscaleImageData);

            ThreadControlCenter.Main.OriginalImage     = newImage;
            ThreadControlCenter.Main.ActiveStereoImage = stereoImage;
            dispose.DisposeDelayed();
            CenterPoint();
        }
Пример #3
0
        private void SnapshotCapturerWork(object sender, DoWorkEventArgs e)
        {
            StereoImage previousStereoImage = null;
            EyeWeb      previousEyeWeb      = null;
            Point       previousPoint       = new Point(0, 0);

            while (!Stop)
            {
                bool changed = false;

                //input
                EyeWeb      eyeWeb      = ThreadControlCenter.Main.ActiveEyeWeb;
                Point       point       = ThreadControlCenter.Main.LeftPoint;
                StereoImage stereoImage = ThreadControlCenter.Main.ActiveStereoImage;

                //output
                Snapshot snapshot = ThreadControlCenter.Main.ActiveSnapshot;

                if (eyeWeb == null || stereoImage == null)
                {
                    continue;
                }

                if (eyeWeb != previousEyeWeb || point != previousPoint || stereoImage != previousStereoImage)
                {
                    changed  = true;
                    snapshot = new Snapshot(stereoImage, eyeWeb, point.X, point.Y);
                }

                previousStereoImage = stereoImage;
                previousEyeWeb      = eyeWeb;
                previousPoint       = point;

                if (changed)
                {
                    ThreadControlCenter.Main.ActiveSnapshot = snapshot;
                }
                else
                {
                    System.Threading.Thread.Sleep(1);
                }
            }
        }