Ejemplo n.º 1
0
        internal void Update()
        {
            if (m_UseIntegration ||
                m_UseClipping ||
                m_UseStretching ||
                m_UseBrightnessContrast ||
                m_UseReInterlacedMode ||
                m_UseHotPixelCorrection ||
                m_HotPixelConfiguration ||
                m_MaskAreaConfiguration)
            {
                if (m_UseIntegration)
                {
                    m_VideoController.SetupFrameIntegration(m_FramesToIntegrate, m_IntegrationMode, m_IntegrationType);
                }
                else
                {
                    m_VideoController.SetupFrameIntegration(1, FrameIntegratingMode.NoIntegration, PixelIntegrationType.Mean);
                }

                TangraCore.PreProcessors.ClearAll();

                if (m_UseStretching)
                {
                    TangraCore.PreProcessors.AddStretching(m_FromByte, m_ToByte);
                }
                else if (m_UseClipping)
                {
                    TangraCore.PreProcessors.AddClipping(m_FromByte, m_ToByte);
                }
                if (m_UseBrightnessContrast)
                {
                    TangraCore.PreProcessors.AddBrightnessContrast(m_Brightness, m_Contrast);
                }

                if (Math.Abs(TangraConfig.Settings.Photometry.EncodingGamma - 1) > 0.01)
                {
                    TangraCore.PreProcessors.AddGammaCorrection(TangraConfig.Settings.Photometry.EncodingGamma);
                }

                if (TangraConfig.Settings.Photometry.KnownCameraResponse != TangraConfig.KnownCameraResponse.Undefined)
                {
                    TangraCore.PreProcessors.AddCameraResponseCorrection(TangraConfig.Settings.Photometry.KnownCameraResponse, TangraConfig.Settings.Photometry.KnownCameraResponseParams);
                }

                HotPixelCorrector.ReconfigurePreProcessing();
                MaskAreaSelector.ReconfigurePreProcessing();

                //if (VideoContext.Current.DarkFrameBytes != null)
                //{
                //    Core.PreProcessors.AddDarkFrame(VideoContext.Current.DarkFrameBytes);
                //    //m_FramePreProcessor.AddPreProcessor(
                //    //    new FrameDarkFlatCorrector(
                //    //        VideoContext.Current.DarkFrameBytes,
                //    //        VideoContext.Current.FlatFrameMedian,
                //    //        true));
                //}

                //if (VideoContext.Current.FlatFrameBytes != null)
                //{
                //    Core.PreProcessors.AddFlatFrame(VideoContext.Current.FlatFrameBytes, VideoContext.Current.FlatFrameMedian);
                //}

                //m_FramePreProcessor.OnPreProcess(m_CurrFrame);

                m_CurrFrame = FramePlayer.GetFrame(m_CurrFrameNo, !m_UseIntegration);

                if (m_CurrFrame != null)
                {
                    frmFullSizePreview.EnsureFullPreviewVisible(m_CurrFrame, ParentForm);
                    frmFullSizePreview.Update(m_CurrFrame);
                }
            }
            else
            {
                TangraCore.PreProcessors.ClearAll();

                frmFullSizePreview.EnsureFullPreviewHidden();
            }
        }