コード例 #1
0
        private void InitializeFixtureNPointToNPoint()
        {
            try
            {
#if (!_USE_BASLER_PYLON && !_USE_IMAGING_CONTROL)
                txtExposure.Text   = m_aAcqFifo.Exposure.ToString();
                txtContrast.Text   = m_aAcqFifo.Contrast.ToString();
                txtBrightness.Text = m_aAcqFifo.Brightness.ToString();
#elif _USE_BASLER_PYLON
                txtExposure.Text   = ABaslerPylon.GetExposureTime(m_aPoint.m_strDevName).ToString();
                txtContrast.Text   = "";
                txtBrightness.Text = "";
#elif _USE_IMAGING_CONTROL
                txtExposure.Text   = AImagingControl.m_rngpExposure.Value.ToString();
                txtContrast.Text   = "";
                txtBrightness.Text = AImagingControl.m_rngpBrightness.Value.ToString();
#endif
            }
            catch
            {
                txtExposure.Text   = "0.5";
                txtContrast.Text   = "0.5";
                txtBrightness.Text = "0.5";
            }
        }
コード例 #2
0
        private void InitializeFindEllipse()
        {
            // 2014.03.27
            m_IsInitializing = true;
            m_aIni           = new AIniFindEllipse(m_nType, m_nPoint, m_nToolIndex);
            m_aIni.Read();
            cmbCalibCase.SelectedItem = m_aIni.CalibCase;

            try
            {
#if (!_USE_BASLER_PYLON && !_USE_IMAGING_CONTROL)
                txtExposure.Text   = m_aAcqFifo.Exposure.ToString();
                txtContrast.Text   = m_aAcqFifo.Contrast.ToString();
                txtBrightness.Text = m_aAcqFifo.Brightness.ToString();
#elif _USE_BASLER_PYLON
                txtExposure.Text   = ABaslerPylon.GetExposureTime(m_aPoint.m_strDevName).ToString();
                txtContrast.Text   = "";
                txtBrightness.Text = "";
#elif _USE_IMAGING_CONTROL
                txtExposure.Text   = AImagingControl.m_rngpExposure.Value.ToString();
                txtContrast.Text   = "";
                txtBrightness.Text = AImagingControl.m_rngpBrightness.Value.ToString();
#endif
            }
            catch
            {
                txtExposure.Text   = "0.5";
                txtContrast.Text   = "0.5";
                txtBrightness.Text = "0.5";
            }
            // 2014.03.27
            m_IsInitializing = false;
        }
コード例 #3
0
        private void InitializeCalibration()
        {
            if (m_aCalibNPointToNPoint.Calibrated == true)
            {
                // 2013.12.02
                stslblStatus.Text      = AUtil.GetXmlLanguage("Calibrated");
                stslblStatus.ForeColor = Color.ForestGreen;
                btnRun.Enabled         = true;
            }

            txtPoint0X.Text = m_aCalibNPointToNPoint.m_pdRawX[0].ToString();
            txtPoint0Y.Text = m_aCalibNPointToNPoint.m_pdRawY[0].ToString();
            txtPoint1X.Text = m_aCalibNPointToNPoint.m_pdRawX[1].ToString();
            txtPoint1Y.Text = m_aCalibNPointToNPoint.m_pdRawY[1].ToString();
            txtPoint2X.Text = m_aCalibNPointToNPoint.m_pdRawX[2].ToString();
            txtPoint2Y.Text = m_aCalibNPointToNPoint.m_pdRawY[2].ToString();

            //btnLoadCalibImage_Click(null, null);

            /*
             * m_aCalibNPointToNPoint.GrabCalibrationImage(m_aDisplay);
             * if (m_aCalibNPointToNPoint.Calibrate(m_aDisplay) == true)
             * {
             *  stslblStatus.Text = "Calibrated!";
             *  stslblStatus.ForeColor = Color.ForestGreen;
             *  btnRun.Enabled = true;
             * }
             */

            try
            {
#if (!_USE_BASLER_PYLON && !_USE_IMAGING_CONTROL)
                txtExposure.Text   = m_aAcqFifo.Exposure.ToString();
                txtContrast.Text   = m_aAcqFifo.Contrast.ToString();
                txtBrightness.Text = m_aAcqFifo.Brightness.ToString();
#elif _USE_BASLER_PYLON
                txtExposure.Text   = ABaslerPylon.GetExposureTime(m_aPoint.m_strDevName).ToString();
                txtContrast.Text   = "";
                txtBrightness.Text = "";
#elif _USE_IMAGING_CONTROL
                txtExposure.Text   = AImagingControl.m_rngpExposure.Value.ToString();
                txtContrast.Text   = "";
                txtBrightness.Text = AImagingControl.m_rngpBrightness.Value.ToString();
#endif
            }
            catch
            {
                txtExposure.Text   = "0.5";
                txtContrast.Text   = "0.5";
                txtBrightness.Text = "0.5";
            }
        }
コード例 #4
0
        private void btnAcquireSingle_Click(object sender, EventArgs e)
        {
            //m_aDisplay.ClearAll();
            m_aDisplay.ClearExcludeImage();
#if (!_USE_BASLER_PYLON && !_USE_IMAGING_CONTROL)
            // 2012.04.24
            m_aAcqFifo.Exposure = Convert.ToDouble(txtExposure.Text);

            /* 2015.10.18
             * if (m_aAcqFifo.AcqFifoTool.Operator != null)
             * {
             *  if (m_aAcqFifo.GetFrameGrabberName().Contains("acA2500"))
             *  {
             *      txtExposure.Text = m_aAcqFifo.Exposure.ToString();
             *  }
             * }
             */
            m_aAcqFifo.Contrast   = Convert.ToDouble(txtContrast.Text);
            m_aAcqFifo.Brightness = Convert.ToDouble(txtBrightness.Text);
#elif _USE_BASLER_PYLON
            // 2017.06.27
            if (ABaslerPylon.GetPixelFormat(m_aPoint.m_strDevName) != m_aPoint.m_strPixelFormat)
            {
                ABaslerPylon.SetPixelFormat(m_aPoint.m_strDevName, m_aPoint.m_strPixelFormat);
            }

            Int64 nVal = Convert.ToInt64(txtExposure.Text);
            nVal             = ABaslerPylon.SetExposureTime(m_aPoint.m_strDevName, nVal);
            txtExposure.Text = nVal.ToString();
#elif _USE_IMAGING_CONTROL
            int nVal = Convert.ToInt32(txtExposure.Text);
            if (AImagingControl.m_rngpExposure.RangeMax < nVal)
            {
                nVal             = AImagingControl.m_rngpExposure.RangeMax;
                txtExposure.Text = nVal.ToString();
            }
            if (AImagingControl.m_rngpExposure.RangeMin > nVal)
            {
                nVal             = AImagingControl.m_rngpExposure.RangeMin;
                txtExposure.Text = nVal.ToString();
            }
            AImagingControl.m_rngpExposure.Value = nVal;

            nVal = Convert.ToInt32(txtBrightness.Text);
            if (AImagingControl.m_rngpBrightness.RangeMax < nVal)
            {
                nVal = AImagingControl.m_rngpBrightness.RangeMax;
                txtBrightness.Text = nVal.ToString();
            }
            if (AImagingControl.m_rngpBrightness.RangeMin > nVal)
            {
                nVal = AImagingControl.m_rngpBrightness.RangeMin;
                txtBrightness.Text = nVal.ToString();
            }
            AImagingControl.m_rngpBrightness.Value = nVal;
#endif

            if (btnAcquireLive.Text != AUtil.GetXmlLanguage("Acquire_Live"))
            {
                // 2011.04.21 Live
                //btnAcquireLive.Text = AUtil.GetXmlLanguage("Acquire_Live");
                //m_aAcqFifo.StopLiveAcquisition(cogDisplay);
                btnAcquireLive_Click(null, null);
            }

            try
            {
                // 2012.04.25
                AVisionProBuild.Acq(m_nType, m_nPoint, ref m_cogImage);
                // 2012.01.17
                m_aDisplay.Image = m_cogImage;

                m_aDisplay.Display.Fit(true);
                m_aCalibCheckerboard.InputImage = m_aDisplay.GetImage8Grey();
            }
            catch
            {
            }

            // 2011.06.09
            lblFileName.Text = "";
        }
コード例 #5
0
        private void InitializeCalibration()
        {
            switch (m_aCalibCheckerboard.ComputationMode)
            {
            case CogCalibFixComputationModeConstants.Linear:
                rdoLinear.Checked        = true;
                chkShowUndistort.Checked = false;
                chkShowUndistort.Enabled = false;
                break;

            case CogCalibFixComputationModeConstants.PerspectiveAndRadialWarp:
                rdoNonlinear.Checked     = true;
                chkShowUndistort.Enabled = true;
                break;
            }

            switch (m_aCalibCheckerboard.Fiducial)
            {
            case CogCalibCheckerboardFiducialConstants.StandardRectangles:
                chkMark.Checked = true;
                break;

            case CogCalibCheckerboardFiducialConstants.None:
                chkMark.Checked = false;
                break;
            }

            if (m_aCalibCheckerboard.Calibrated == true)
            {
                // 2013.12.02
                stslblStatus.Text      = AUtil.GetXmlLanguage("Calibrated");
                stslblStatus.ForeColor = Color.ForestGreen;
            }

            chkSwap.Checked       = m_aCalibCheckerboard.SwapHandedness;
            txtSizeX.Text         = m_aCalibCheckerboard.SizeX.ToString();
            txtSizeY.Text         = m_aCalibCheckerboard.SizeY.ToString();
            numUpDnX.Value        = (decimal)m_aCalibCheckerboard.OriginX;
            numUpDnY.Value        = (decimal)m_aCalibCheckerboard.OriginY;
            numUpDnRotation.Value = (decimal)(m_aCalibCheckerboard.OriginRotation / Math.PI * 180);

            /*
             * btnLoadCalibImage_Click(null, null);
             * m_aCalibCheckerboard.GrabCalibrationImage(m_aDisplay);
             * if (m_aCalibCheckerboard.Calibrate(m_aDisplay, chkShowUndistort.Checked) == true)
             * {
             *  m_aCalibCheckerboard.GetResultToList(lstvwResult);
             *  stslblStatus.Text = "Calibrated!";
             *  stslblStatus.ForeColor = Color.ForestGreen;
             * }
             */

            m_aCalibCheckerboard.CoordinateAxes_DraggingStopped += new ACalibCheckerboard.SendMes(CoordinateAxes_DraggingStopped);

            try
            {
#if (!_USE_BASLER_PYLON && !_USE_IMAGING_CONTROL)
                txtExposure.Text   = m_aAcqFifo.Exposure.ToString();
                txtContrast.Text   = m_aAcqFifo.Contrast.ToString();
                txtBrightness.Text = m_aAcqFifo.Brightness.ToString();
#elif _USE_BASLER_PYLON
                txtExposure.Text   = ABaslerPylon.GetExposureTime(m_aPoint.m_strDevName).ToString();
                txtContrast.Text   = "";
                txtBrightness.Text = "";
#elif _USE_IMAGING_CONTROL
                txtExposure.Text   = AImagingControl.m_rngpExposure.Value.ToString();
                txtContrast.Text   = "";
                txtBrightness.Text = AImagingControl.m_rngpBrightness.Value.ToString();
#endif
            }
            catch
            {
                txtExposure.Text   = "0.5";
                txtContrast.Text   = "0.5";
                txtBrightness.Text = "0.5";
            }
        }
コード例 #6
0
        private void btnAcquireSingle_Click(object sender, EventArgs e)
        {
            // 2016.12.01
            chkRun.Visible = false;

#if (!_USE_BASLER_PYLON && !_USE_IMAGING_CONTROL)
            // 2012.04.24
            m_aAcqFifo.Exposure = Convert.ToDouble(txtExposure.Text);

            /* 2015.10.18
             * if (m_aAcqFifo.AcqFifoTool.Operator != null)
             * {
             *  if (m_aAcqFifo.GetFrameGrabberName().Contains("acA2500"))
             *  {
             *      txtExposure.Text = m_aAcqFifo.Exposure.ToString();
             *  }
             * }
             */
            m_aAcqFifo.Contrast   = Convert.ToDouble(txtContrast.Text);
            m_aAcqFifo.Brightness = Convert.ToDouble(txtBrightness.Text);
#elif _USE_BASLER_PYLON
            Int64 nVal = Convert.ToInt64(txtExposure.Text);
            nVal             = ABaslerPylon.SetExposureTime(m_aPoint.m_strDevName, nVal);
            txtExposure.Text = nVal.ToString();
#elif _USE_IMAGING_CONTROL
            int nVal = Convert.ToInt32(txtExposure.Text);
            if (AImagingControl.m_rngpExposure.RangeMax < nVal)
            {
                nVal             = AImagingControl.m_rngpExposure.RangeMax;
                txtExposure.Text = nVal.ToString();
            }
            if (AImagingControl.m_rngpExposure.RangeMin > nVal)
            {
                nVal             = AImagingControl.m_rngpExposure.RangeMin;
                txtExposure.Text = nVal.ToString();
            }
            AImagingControl.m_rngpExposure.Value = nVal;

            nVal = Convert.ToInt32(txtBrightness.Text);
            if (AImagingControl.m_rngpBrightness.RangeMax < nVal)
            {
                nVal = AImagingControl.m_rngpBrightness.RangeMax;
                txtBrightness.Text = nVal.ToString();
            }
            if (AImagingControl.m_rngpBrightness.RangeMin > nVal)
            {
                nVal = AImagingControl.m_rngpBrightness.RangeMin;
                txtBrightness.Text = nVal.ToString();
            }
            AImagingControl.m_rngpBrightness.Value = nVal;
#endif
            if (btnAcquireLive.Text != "        " + AUtil.GetXmlLanguage("Acquire_Live"))
            {
                // 2011.04.21 Live
                //btnAcquireLive.Text = "        " + AUtil.GetXmlLanguage("Acquire_Live");
                //m_aAcqFifo.StopLiveAcquisition(cogDisplay);
                btnAcquireLive_Click(null, null);
            }

            try
            {
                // 2012.04.25
                AVisionProBuild.Acq(m_nType, m_nPoint, ref m_cogImage);
                m_aFixtureNPointToNPoint.InputImage = m_cogImage;
            }
            catch
            {
            }
            // 2011.06.09
            lblFileName.Text = "";
        }