Ejemplo n.º 1
0
        private void PopulateStreamFormat()
        {
            lblColorSpace.Text = CameraLang.FormConfiguration_Properties_StreamFormat;

            IGXFeatureControl featureControl = device.GetRemoteFeatureControl();

            if (featureControl == null)
            {
                return;
            }

            SpecificInfo specific = summary.Specific as SpecificInfo;
            List <DahengStreamFormat> streamFormats = DahengHelper.GetSupportedStreamFormats(featureControl);

            cmbFormat.Items.Clear();

            foreach (DahengStreamFormat streamFormat in streamFormats)
            {
                cmbFormat.Items.Add(streamFormat);
                if (streamFormat == specific.StreamFormat)
                {
                    selectedStreamFormat    = streamFormat;
                    cmbFormat.SelectedIndex = cmbFormat.Items.Count - 1;
                }
            }

            if (cmbFormat.SelectedIndex < 0)
            {
                selectedStreamFormat    = (DahengStreamFormat)cmbFormat.Items[0];
                cmbFormat.SelectedIndex = 0;
            }
        }
Ejemplo n.º 2
0
        private void cmbFormat_SelectedIndexChanged(object sender, EventArgs e)
        {
            DahengStreamFormat selected = (DahengStreamFormat)cmbFormat.SelectedItem;

            if (selectedStreamFormat == selected)
            {
                return;
            }

            selectedStreamFormat = selected;
            specificChanged      = true;
        }
Ejemplo n.º 3
0
        public static ImageFormat ConvertImageFormat(DahengStreamFormat format)
        {
            switch (format)
            {
            case DahengStreamFormat.RGB:
                return(ImageFormat.RGB24);

            case DahengStreamFormat.Mono:
            case DahengStreamFormat.Raw:
            default:
                return(ImageFormat.Y800);
            }
        }
Ejemplo n.º 4
0
        private void Open()
        {
            if (device != null)
            {
                Close();
            }

            bool open = false;

            try
            {
                device         = igxFactory.OpenDeviceBySN(summary.Identifier, GX_ACCESS_MODE.GX_ACCESS_EXCLUSIVE);
                featureControl = device.GetRemoteFeatureControl();
                DahengHelper.AfterOpen(featureControl);
                open = true;
            }
            catch
            {
                log.DebugFormat("Could not open Daheng device.");
            }

            if (!open)
            {
                return;
            }

            SpecificInfo specific = summary.Specific as SpecificInfo;

            if (specific == null)
            {
                return;
            }

            // Store the camera object into the specific info so that we can retrieve device informations from the configuration dialog.
            specific.Device = device;
            isColor         = DahengHelper.IsColor(featureControl);

            if (firstOpen)
            {
                // Always default to RGB24 for color cameras and Y800 for mono cameras.
                // Raw mode will have to be switched explicitly everytime for now.
                currentStreamFormat = isColor ? DahengStreamFormat.RGB : DahengStreamFormat.Mono;

                // Grab current values.
                Dictionary <string, CameraProperty> cameraProperties = CameraPropertyManager.Read(device);
                specific.CameraProperties = cameraProperties;
                specific.StreamFormat     = currentStreamFormat;
            }
            else
            {
                CameraPropertyManager.WriteCriticalProperties(device, specific.CameraProperties);
                if (specific.StreamFormat != currentStreamFormat)
                {
                    currentStreamFormat = specific.StreamFormat;
                }
            }

            try
            {
                stream = device.OpenStream(0);
            }
            catch
            {
                log.Debug("Could not start Daheng device.");
            }
        }
Ejemplo n.º 5
0
 public SpecificInfo()
 {
     StreamFormat     = DahengStreamFormat.None;
     CameraProperties = new Dictionary <string, CameraProperty>();
 }