예제 #1
0
 public void Stop()
 {
     if (_video != null)
     {
         _video.StopVideo();
     }
 }
예제 #2
0
 private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (_video != null)
     {
         _video.StopVideo();
         _video = null;
     }
 }
        public void NextFrame(int frameNo, Model.Video.MovementType movementType, bool isLastFrame, Model.Astro.AstroImage astroImage, int firstFrameInIntegrationPeriod, string fileName)
        {
            if (m_Converting)
            {
                m_ConvertVideoToAavController.ProcessFrame(frameNo, astroImage);

                if (isLastFrame || frameNo > m_LastFrameNo)
                {
                    m_ConvertVideoToAavController.FinishedConversion();
                    m_ControlPanel.EndConversion();

                    m_VideoController.StopVideo();
                    m_ControlPanel.UpdateProgress(m_LastFrameNo, m_LastFrameNo);
                }
                else
                {
                    m_ControlPanel.UpdateProgress(frameNo - m_FirstFrameNo, m_LastFrameNo);
                }
            }
        }
예제 #4
0
        public void NextFrame(int frameNo, MovementType movementType, bool isLastFrame, AstroImage astroImage, int firstFrameInIntegrationPeriod, string frameFileName)
        {
            m_CurrentAstroImage = astroImage;
            m_FrameNumber       = frameNo;
            TangraContext.Current.CrashReportInfo.FrameNumber = frameNo;

            if (m_Running)
            {
                if (m_FramesDone < m_NumFrames)
                {
                    Pixelmap currPixelmap = astroImage.Pixelmap;
                    if (m_FramesDone == 0)
                    {
                        m_AveragedData = new float[currPixelmap.Width, currPixelmap.Height];
                    }

                    for (int x = 0; x < currPixelmap.Width; x++)
                    {
                        for (int y = 0; y < currPixelmap.Height; y++)
                        {
                            m_AveragedData[x, y] += currPixelmap[x, y];
                        }
                    }

                    m_FramesDone++;
                    m_ControlPanel.SetProgress(m_FramesDone);

                    if (m_FramesDone == m_NumFrames)
                    {
                        // Averaging
                        for (int x = 0; x < currPixelmap.Width; x++)
                        {
                            for (int y = 0; y < currPixelmap.Height; y++)
                            {
                                m_AveragedData[x, y] = (m_AveragedData[x, y] / (ulong)m_FramesDone);
                            }
                        }

                        m_ControlPanel.SetStopped();

                        string fileName = string.Format("{0}_{1}.fit", Path.GetFileNameWithoutExtension(m_VideoController.CurrentVideoFileName), m_FrameType.ToString());

                        if (m_VideoController.ShowSaveFileDialog(
                                "Save " + m_FrameType.ToString() + " fame",
                                "FITS Image (*.fit)|*.fit",
                                ref fileName) == DialogResult.OK)
                        {
                            string notes = string.Format("{0} generated from {1}", m_FrameType.ToString(), Path.GetFileNameWithoutExtension(m_VideoController.CurrentVideoFileName));

                            SaveDarkOrFlatFrame(fileName, currPixelmap.Width, currPixelmap.Height, notes, m_AveragedData, m_ExposureSeconds, m_NumFrames);
                        }

                        m_Running = false;
                        m_VideoController.StopVideo();

                        if (m_FrameType == FrameType.Dark)
                        {
                            UsageStats.Instance.DarkFramesProduced++;
                        }
                        if (m_FrameType == FrameType.MasterFlat)
                        {
                            UsageStats.Instance.FlatFramesProduced++;
                        }

                        UsageStats.Instance.Save();
                    }
                }
            }
        }