Beispiel #1
0
        private void onPixelFormat_CheckedChanged(object sender, EventArgs e)
        {
            uEye.Defines.ColorMode        colorMode   = 0;
            uEye.Defines.ColorConvertMode convertMode = 0;

            if (radioButtonRaw8Normal.Checked)
            {
                colorMode   = uEye.Defines.ColorMode.SensorRaw8;
                convertMode = uEye.Defines.ColorConvertMode.Software3X3;
            }
            else if (radioButtonRaw8High.Checked)
            {
                colorMode   = uEye.Defines.ColorMode.SensorRaw8;
                convertMode = uEye.Defines.ColorConvertMode.Software5X5;
            }
            else if (radioButtonRaw8Hardware.Checked)
            {
                colorMode   = uEye.Defines.ColorMode.SensorRaw8;
                convertMode = uEye.Defines.ColorConvertMode.Hardware3X3;
            }
            else if (radioButtonRaw12Normal.Checked)
            {
                colorMode   = uEye.Defines.ColorMode.SensorRaw12;
                convertMode = uEye.Defines.ColorConvertMode.Software3X3;
            }
            else if (radioButtonRaw12High.Checked)
            {
                colorMode   = uEye.Defines.ColorMode.SensorRaw12;
                convertMode = uEye.Defines.ColorConvertMode.Software5X5;
            }
            else if (radioButtonRaw12Hardware.Checked)
            {
                colorMode   = uEye.Defines.ColorMode.SensorRaw12;
                convertMode = uEye.Defines.ColorConvertMode.Hardware3X3;
            }
            else if (radioButtonRaw16Normal.Checked)
            {
                colorMode   = uEye.Defines.ColorMode.SensorRaw16;
                convertMode = uEye.Defines.ColorConvertMode.Software3X3;
            }
            else if (radioButtonRaw16High.Checked)
            {
                colorMode   = uEye.Defines.ColorMode.SensorRaw16;
                convertMode = uEye.Defines.ColorConvertMode.Software5X5;
            }
            else if (radioButtonRaw16Hardware.Checked)
            {
                colorMode   = uEye.Defines.ColorMode.SensorRaw16;
                convertMode = uEye.Defines.ColorConvertMode.Hardware3X3;
            }
            else if (radioButtonGray8Normal.Checked)
            {
                colorMode   = uEye.Defines.ColorMode.Mono8;
                convertMode = uEye.Defines.ColorConvertMode.Software3X3;
            }
            else if (radioButtonGray8High.Checked)
            {
                colorMode   = uEye.Defines.ColorMode.Mono8;
                convertMode = uEye.Defines.ColorConvertMode.Software5X5;
            }
            else if (radioButtonGray8Hardware.Checked)
            {
                colorMode   = uEye.Defines.ColorMode.Mono8;
                convertMode = uEye.Defines.ColorConvertMode.Hardware3X3;
            }
            else if (radioButtonGray12Normal.Checked)
            {
                colorMode   = uEye.Defines.ColorMode.Mono12;
                convertMode = uEye.Defines.ColorConvertMode.Software3X3;
            }
            else if (radioButtonGray12High.Checked)
            {
                colorMode   = uEye.Defines.ColorMode.Mono12;
                convertMode = uEye.Defines.ColorConvertMode.Software5X5;
            }
            else if (radioButtonGray12Hardware.Checked)
            {
                colorMode   = uEye.Defines.ColorMode.Mono12;
                convertMode = uEye.Defines.ColorConvertMode.Hardware3X3;
            }
            else if (radioButtonGray16Normal.Checked)
            {
                colorMode   = uEye.Defines.ColorMode.Mono16;
                convertMode = uEye.Defines.ColorConvertMode.Software3X3;
            }
            else if (radioButtonGray16High.Checked)
            {
                colorMode   = uEye.Defines.ColorMode.Mono16;
                convertMode = uEye.Defines.ColorConvertMode.Software5X5;
            }
            else if (radioButtonGray16Hardware.Checked)
            {
                colorMode   = uEye.Defines.ColorMode.Mono16;
                convertMode = uEye.Defines.ColorConvertMode.Hardware3X3;
            }
            else if (radioButtonRGB24Normal.Checked)
            {
                colorMode   = uEye.Defines.ColorMode.BGR8Packed;
                convertMode = uEye.Defines.ColorConvertMode.Software3X3;
            }
            else if (radioButtonRGB24High.Checked)
            {
                colorMode   = uEye.Defines.ColorMode.BGR8Packed;
                convertMode = uEye.Defines.ColorConvertMode.Software5X5;
            }
            else if (radioButtonRGB24Hardware.Checked)
            {
                colorMode   = uEye.Defines.ColorMode.BGR8Packed;
                convertMode = uEye.Defines.ColorConvertMode.Hardware3X3;
            }
            else if (radioButtonRGB32Normal.Checked)
            {
                colorMode   = uEye.Defines.ColorMode.BGRA8Packed;
                convertMode = uEye.Defines.ColorConvertMode.Software3X3;
            }
            else if (radioButtonRGB32High.Checked)
            {
                colorMode   = uEye.Defines.ColorMode.BGRA8Packed;
                convertMode = uEye.Defines.ColorConvertMode.Software5X5;
            }
            else if (radioButtonRGB32Hardware.Checked)
            {
                colorMode   = uEye.Defines.ColorMode.BGRA8Packed;
                convertMode = uEye.Defines.ColorConvertMode.Hardware3X3;
            }

            uEye.Defines.Status statusRet;

            Boolean isLive;

            statusRet = m_Camera.Acquisition.HasStarted(out isLive);

            if (isLive)
            {
                statusRet = m_Camera.Acquisition.Stop(uEye.Defines.DeviceParameter.Wait);
            }

            statusRet = m_Camera.PixelFormat.Set(colorMode);
            statusRet = m_Camera.Color.Converter.Set(colorMode, convertMode);

            // memory reallocation
            int[] idList;
            m_Camera.Memory.GetList(out idList);

            statusRet = MemoryHelper.ClearSequence(m_Camera);
            statusRet = MemoryHelper.FreeImageMems(m_Camera);

            statusRet = MemoryHelper.AllocImageMems(m_Camera, idList.Count());
            statusRet = MemoryHelper.InitSequence(m_Camera);

            if (isLive)
            {
                statusRet = m_Camera.Acquisition.Capture();
            }
        }