static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                return;
            }

            double phaseShift = double.Parse(args[0], CultureInfo.InvariantCulture);

            int    width        = 4096;
            int    height       = 1024;
            double percentNoise = 0;

            int    fringeCount  = 10;
            double minIntensity = 35;

            InterferogramInfo interferogramInfo = new InterferogramInfo(width, height, percentNoise, minIntensity);
            LinearFringeInterferogramCreator interferogramCreator = new LinearFringeInterferogramCreator(interferogramInfo, fringeCount);

            RealMatrix interferogramMatrix = interferogramCreator.CreateInterferogram(phaseShift);

            WriteableBitmap writeableBitmap =
                WriteableBitmapCreator.CreateGrayScaleWriteableBitmapFromMatrix(interferogramMatrix, OS.IntegerSystemDpiX, OS.IntegerSystemDpiY);

            MemoryWriter.Write <WriteableBitmap>(writeableBitmap, new WriteableBitmapSerialization());

            SynchronizationManager.SetSignal(HoloCommon.Synchronization.Events.Image.IMAGE_CREATED);
        }
示例#2
0
        private void btnTakeSeries_Click(object sender, EventArgs e)
        {
            double phaseShift     = 0;
            double phaseShiftStep = GetPhaseShiftStep();

            Action takePictureAction = () =>
            {
                Thread.Sleep(PICTURE_TAKEN_DELAY);
                SynchronizationManager.SetSignal(HoloCommon.Synchronization.Events.Camera.TAKE_PICTURE);
            };

            Action pictureTakenAction = () =>
            {
                if (phaseShift < 2 * Math.PI)
                {
                    CreateInterferogram(phaseShift);
                    phaseShift += phaseShiftStep;
                }
            };

            Thread thread1 = SynchronizationManager.RunActionOnSignal(pictureTakenAction, HoloCommon.Synchronization.Events.Image.IMAGE_SAVED);
            Thread thread2 = SynchronizationManager.RunActionOnSignal(takePictureAction, HoloCommon.Synchronization.Events.Image.IMAGE_UPDATED);

            SynchronizationManager.SetSignal(HoloCommon.Synchronization.Events.Image.IMAGE_UPDATED);
        }
示例#3
0
        static void Main(string[] args)
        {
            SynchronizationManager.RunActionOnSignal(PictureTakenHandler, Events.Camera.PICTURE_TAKEN);

            string command = null;

            while (!String.Equals(command, "q", StringComparison.OrdinalIgnoreCase))
            {
                command = Console.ReadLine();
                if (command == "sync")
                {
                    SynchronizationManager.SetSignal(Events.Camera.TAKE_PICTURE);
                }
            }
        }
        private void SDK_ImageDownloaded(Bitmap bitmap, ImageType imageType)
        {
            Bitmap newBitmap = new Bitmap(bitmap);

            MemoryWriter.Write(newBitmap, new ImageSerialization());
            SynchronizationManager.SetSignal(HoloCommon.Synchronization.Events.Camera.PICTURE_TAKEN);

            if (PictureTaken != null)
            {
                short number = 0;

                if (seriesType == TakePhotoSeriesTypeEnum.ImageSeries)
                {
                    number = currentImageNumber;
                }
                if (seriesType == TakePhotoSeriesTypeEnum.PhaseShifts)
                {
                    number = currentPhaseShiftNumber;
                }

                if (!is256Frames)
                {
                    PictureTakenEventArgs eventArgs = new PictureTakenEventArgs()
                    {
                        Image            = bitmap,
                        StartImageNumber = startImageNumber,
                        Number           = number,
                        GroupNumber      = groupNumber,
                        PhaseShiftValue  = Convert.ToInt16(currentPhaseShiftValue),
                        ColorMode        = colorMode
                    };

                    PictureTaken(eventArgs);
                }
                else
                {
                    //Save bitmap
                    string fileName = string.Format("{0}.jpg", currentImageNumber.ToString());
                    string filePath = Path.Combine(frames256Directory, fileName);

                    Bitmap image = new Bitmap(bitmap);
                    image.Save(filePath);
                }
            }

            TryTakeNextPhoto();
        }
示例#5
0
        private void Form1_Shown(object sender, EventArgs e)
        {
            int    width        = 4096;
            int    height       = 2048;
            double percentNoise = 0;

            int    fringeCount  = 20;
            double minIntensity = 35;

            InterferogramInfo interferogramInfo = new InterferogramInfo(width, height, percentNoise, minIntensity);
            LinearFringeInterferogramCreator interferogramCreator = new LinearFringeInterferogramCreator(interferogramInfo, fringeCount);

            double     phaseShift          = 0;
            RealMatrix interferogramMatrix = interferogramCreator.CreateInterferogram(phaseShift);

            WriteableBitmap writeableBitmap =
                WriteableBitmapCreator.CreateGrayScaleWriteableBitmapFromMatrix(interferogramMatrix, OS.IntegerSystemDpiX, OS.IntegerSystemDpiY);

            MemoryWriter.Write <WriteableBitmap>(writeableBitmap, new WriteableBitmapSerialization());

            //ProcessManager.RunProcess(@"D:\Projects\HoloApplication\Modules\ImageViewer\ImageViewer\bin\Release\ImageViewer.exe", null, false);
            SynchronizationManager.SetSignal(HoloCommon.Synchronization.Events.Image.IMAGE_CREATED);
        }
 private static void Process()
 {
     Console.WriteLine("picture taken");
     SynchronizationManager.SetSignal(Events.Camera.PICTURE_TAKEN);
 }
示例#7
0
 private void btnTakePicture_Click(object sender, EventArgs e)
 {
     SynchronizationManager.SetSignal(HoloCommon.Synchronization.Events.Camera.TAKE_PICTURE);
 }