Ejemplo n.º 1
0
        private void toolStripMenuItemLoadParameterFromEEPROM_Click(object sender, EventArgs e)
        {
            if (m_IsLive)
            {
                m_Camera.Acquisition.Stop();
            }

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

            m_Camera.Parameter.Load();

            uEye.Defines.ColorMode colorMode;
            m_Camera.PixelFormat.Get(out colorMode);

            // allocate new standard memory
            MemoryHelper.AllocImageMems(m_Camera, m_cnNumberOfSeqBuffers);
            MemoryHelper.InitSequence(m_Camera);

            if (m_IsLive)
            {
                m_Camera.Acquisition.Capture();
            }

            UpdateToolbar();
        }
Ejemplo n.º 2
0
        private void SetAoiHeight(Int32 s32Value)
        {
            uEye.Defines.Status      statusRet;
            System.Drawing.Rectangle rect;

            uEye.Types.Range <Int32> rangeWidth, rangeHeight;
            statusRet = m_Camera.Size.AOI.GetPosRange(out rangeWidth, out rangeHeight);

            while ((s32Value % rangeHeight.Increment) != 0)
            {
                --s32Value;
            }

            statusRet   = m_Camera.Size.AOI.Get(out rect);
            rect.Height = s32Value;
            numericUpDownAoiHeight.Value = s32Value;
            trackBarAoiHeight.Value      = s32Value;

            Boolean isLive;

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

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

            statusRet = m_Camera.Size.AOI.Set(rect);

            // update top aoi
            numericUpDownAoiTop.Minimum = 0;
            numericUpDownAoiTop.Maximum = numericUpDownAoiTop.Value + trackBarAoiHeight.Maximum - trackBarAoiHeight.Value;
            trackBarAoiTop.SetRange((int)numericUpDownAoiTop.Minimum, (int)numericUpDownAoiTop.Maximum);

            labelAoiTopMin.Text = trackBarAoiTop.Minimum.ToString();
            labelAoiTopMax.Text = trackBarAoiTop.Maximum.ToString();

            // 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();
            }

            // inform our main form
            AOIChanged.Invoke(this, EventArgs.Empty);
        }
Ejemplo n.º 3
0
        private uEye.Defines.Status initCamera()
        {
            CameraChoose chooseForm = new CameraChoose();

            uEye.Defines.Status statusRet = uEye.Defines.Status.NO_SUCCESS;

            if (chooseForm.ShowDialog() == DialogResult.OK)
            {
                statusRet = m_Camera.Init(chooseForm.DeviceID | (Int32)uEye.Defines.DeviceEnumeration.UseDeviceID, pictureBoxDisplay.Handle);
                if (statusRet != uEye.Defines.Status.SUCCESS)
                {
                    MessageBox.Show("Initializing the camera failed");
                    return(statusRet);
                }

                statusRet = MemoryHelper.AllocImageMems(m_Camera, m_cnNumberOfSeqBuffers);
                if (statusRet != uEye.Defines.Status.SUCCESS)
                {
                    MessageBox.Show("Allocating memory failed");
                    return(statusRet);
                }

                statusRet = MemoryHelper.InitSequence(m_Camera);
                if (statusRet != uEye.Defines.Status.SUCCESS)
                {
                    MessageBox.Show("Add to sequence failed");
                    return(statusRet);
                }

                // set event
                m_Camera.EventFrame += onFrameEvent;

                // reset framecount
                m_s32FrameCount = 0;

                // start update timer for our statusbar
                m_UpdateTimer.Start();

                uEye.Types.SensorInfo sensorInfo;
                m_Camera.Information.GetSensorInfo(out sensorInfo);

                pictureBoxDisplay.SizeMode      = PictureBoxSizeMode.Normal;
                toolStripStatusLabelCamera.Text = sensorInfo.SensorName;
            }

            return(statusRet);
        }
Ejemplo n.º 4
0
        private void comboBoxFormatSubsamplingVertical_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBoxFormatSubsamplingVertical.Focused)
            {
                uEye.Defines.Status statusRet;

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

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

                uEye.Defines.SubsamplingMode mode = GetSubsamplingMode();
                statusRet = m_Camera.Size.Subsampling.Set(mode);

                // 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();
                }

                updateHorizontalSubsampling();
                updateVerticalBinning();
                updateHorizontalBinning();

                // inform our main form
                AOIChanged.Invoke(this, EventArgs.Empty);
            }
        }
Ejemplo n.º 5
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();
            }
        }