Capture() public method

Captures the calibrated texture
public Capture ( ImageUtility _Source, CameraCalibrationDatabase _Database, CaptureParms _Parms ) : void
_Source ImageUtility The source image to capture
_Database CameraCalibrationDatabase Database to perform proper calibration
_Parms CaptureParms Parameters for the capture
return void
Example #1
0
        private void buttonCapture_Click( object sender, EventArgs e )
        {
            if ( m_BitmapXYZ == null )
            {	// No image loaded you moron!
                MessageBox( "Can't capture as no image is currently loaded!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
                return;
            }
            if ( !PrepareDatabase() )
                return;

            //////////////////////////////////////////////////////////////////////////
            // Prepare parameters
            CalibratedTexture.CaptureParms	Parms = new CalibratedTexture.CaptureParms() {
                SourceImageName = m_ImageFileName.FullName,

                ISOSpeed = floatTrackbarControlISOSpeed.Value,
                ShutterSpeed = floatTrackbarControlShutterSpeed.Value,
                Aperture = floatTrackbarControlAperture.Value,

                CropSource = !outputPanel.IsDefaultCropRectangle,
                CropRectangleCenter = new ImageUtility.float2( outputPanel.CropRectangeCenter.x, outputPanel.CropRectangeCenter.y ),
                CropRectangleHalfSize = new ImageUtility.float2( outputPanel.CropRectangeHalfSize.x, outputPanel.CropRectangeHalfSize.y ),
                CropRectangleRotation = outputPanel.CropRectangeRotation,

                UseModeInsteadOfMean = checkBoxUseMeanMode.Checked,
            };

            //////////////////////////////////////////////////////////////////////////
            // Go!
            try
            {
                CalibratedTexture	Tex = new CalibratedTexture();
                Tex.Capture( m_BitmapXYZ, m_CalibrationDatabase, Parms );
                m_Texture = Tex;

                // Use the form's swatch panels as default swatch size
                m_Texture.SwatchWidth = panelCustomSwatch0.Width-2;
                m_Texture.SwatchHeight = panelCustomSwatch0.Height-2;

                // Update UI
                resultTexturePanel.CalibratedTexture = m_Texture;
                buttonSaveCalibratedImage.Enabled = true;
                labelCaptureWhiteReflectanceCorrection.Text = "White Correction " + Tex.WhiteReflectanceCorrectionFactor.ToString( "G4" );
                labelCaptureSpatialCorrectionStatus.Text = "Spatial Correction is " + (Tex.SpatialCorrectionEnabled ? "enabled" : "disabled");

                m_SwatchMin.m_xyY = m_Texture.SwatchMin.xyY;
                m_SwatchMin.UpdateSwatchColor();
                m_SwatchMax.m_xyY = m_Texture.SwatchMax.xyY;
                m_SwatchMax.UpdateSwatchColor();
                m_SwatchAvg.m_xyY = m_Texture.SwatchAvg.xyY;
                m_SwatchAvg.UpdateSwatchColor();

                foreach ( CustomSwatch S in m_CustomSwatches )
                    S.UpdateSwatchColor();
            }
            catch ( Exception _e )
            {
                MessageBox( "An error occurred during capture:\r\n\r\n", _e );
            }
        }