private void SDK_LiveViewUpdated(Stream img)
        {
            if (!isLiveViewHandled)
            {
                return;
            }

            isLiveViewHandled = false;

            try
            {
                Evf_Bmp = new Bitmap(img);

                if (LiveViewUpdated != null && isMakePhaseShiftsProcess)
                {
                    LiveViewUpdatedEventArgs args = new LiveViewUpdatedEventArgs()
                    {
                        Image            = Evf_Bmp,
                        PhaseShiftNumber = currentPhaseShiftNumber,
                        PhaseShiftValue  = Convert.ToInt16(currentPhaseShiftValue),
                        ColorMode        = colorMode
                    };

                    LiveViewUpdated(args);
                }
                else
                {
                    using (Graphics g = LiveViewPicBox.CreateGraphics())
                    {
                        g.DrawImage(Evf_Bmp, 0, 0, Evf_Bmp.Width, Evf_Bmp.Height);
                    }
                }

                if (isMakePhaseShiftsProcess)
                {
                    if (executeNextShift)
                    {
                        currentPhaseShiftNumber++;
                        currentPhaseShiftValue += phaseShiftStep;
                        if (currentPhaseShiftNumber == phaseShiftCount)
                        {
                            executeNextShift         = false;
                            isMakePhaseShiftsProcess = false;
                        }
                        else
                        {
                            executeNextShift = true;
                        }

                        if (currentPhaseShiftNumber <= phaseShiftCount)
                        {
                            ExecutePhaseShift();
                        }
                    }
                }
            }
            catch (Exception ex) { ReportError(ex.Message, false); }

            isLiveViewHandled = true;
        }
Esempio n. 2
0
 private void SDK_LiveViewUpdated(Stream img)
 {
     try
     {
         Evf_Bmp = new Bitmap(img);
         using (Graphics g = LiveViewPicBox.CreateGraphics())
         {
             LVBratio = LVBw / (float)LVBh;
             LVration = Evf_Bmp.Width / (float)Evf_Bmp.Height;
             if (LVBratio < LVration)
             {
                 w = LVBw;
                 h = (int)(LVBw / LVration);
             }
             else
             {
                 w = (int)(LVBh * LVration);
                 h = LVBh;
             }
             g.DrawImage(Evf_Bmp, 0, 0, w, h);
         }
         Evf_Bmp.Dispose();
     }
     catch (Exception ex) { ReportError(ex.Message, false); }
 }
Esempio n. 3
0
 private void LiveViewPicBox_SizeChanged(object sender, EventArgs e)
 {
     try
     {
         LVBw = LiveViewPicBox.Width;
         LVBh = LiveViewPicBox.Height;
         LiveViewPicBox.Invalidate();
     }
     catch (Exception ex) { ReportError(ex.Message, false); }
 }
Esempio n. 4
0
 private void MainCamera_LiveViewUpdated(Camera sender, Stream img)
 {
     try
     {
         lock (LvLock)
         {
             Evf_Bmp?.Dispose();
             Evf_Bmp = new Bitmap(img);
         }
         LiveViewPicBox.Invalidate();
     }
     catch (Exception ex) { ReportError(ex.Message, false); }
 }
Esempio n. 5
0
 private void EnableLiveView(bool enabled)
 {
     if (LiveViewPicBox.InvokeRequired)
     {
         LiveViewPicBox.BeginInvoke(new dgEnableLiveView(EnableLiveView), new object[] { enabled });
     }
     else
     {
         try
         {
             LiveViewPicBox.Enabled = true;
         }
         catch (Exception)
         {
         }
     }
 }
Esempio n. 6
0
 private void SDK_LiveViewUpdated(Stream img)
 {
     Evf_Bmp = new Bitmap(img);
     using (Graphics g = LiveViewPicBox.CreateGraphics())
     {
         LVBratio = LVBw / (float)LVBh;
         LVration = Evf_Bmp.Width / (float)Evf_Bmp.Height;
         if (LVBratio < LVration)
         {
             w = LVBw;
             h = (int)(LVBw / LVration);
         }
         else
         {
             w = (int)(LVBh * LVration);
             h = LVBh;
         }
         g.DrawImage(Evf_Bmp, 0, 0, w, h);
     }
 }
Esempio n. 7
0
        private void SDK_LiveViewUpdated(Stream img)
        {
            Evf_Bmp = new Bitmap(img);

            if (radioShowLiveView.Checked == true)
            {
                using (Graphics g = LiveViewPicBox.CreateGraphics())
                {
                    LVBratio = LVBw / (float)LVBh;
                    LVration = Evf_Bmp.Width / (float)Evf_Bmp.Height;
                    if (LVBratio < LVration)
                    {
                        w = LVBw;
                        h = (int)(LVBw / LVration);
                    }
                    else
                    {
                        w = (int)(LVBh * LVration);
                        h = LVBh;
                    }
                    g.DrawImage(Evf_Bmp, 0, 0, w, h);
                }
            }
            else
            {
                long lastImageMilliSeconds = (DateTime.Now - lastImageTime).Milliseconds;
                lastImageMilliSeconds += (DateTime.Now - lastImageTime).Seconds * 1000;

                if (lastImageMilliSeconds > 650)
                {
                    lastImageTime = DateTime.Now;
                    imageID++;
                    string fullImageName = images.ImageDir + imageID + ".jpg";
                    Evf_Bmp.Save(fullImageName, System.Drawing.Imaging.ImageFormat.Jpeg);
                    images.CallMatlab(fullImageName);
                }
            }
            Evf_Bmp.Dispose();
        }