public static PixelFormatInfo ConvertPixelFormat(TexFormat format)
        {
            if (!PixelFormatList.ContainsKey(format))
            {
                return(PixelFormatList[TexFormat.RGBA8_UNORM]);
            }

            return(PixelFormatList[format]);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 读取相机参数
        /// </summary>
        private void ReadCameraParamList()
        {
            if (Camera?.IsOpen == true)
            {
                //获取像素类型列表
                if (Camera.PixelFormatTypeEnum != null)
                {
                    //设置列表
                    if (PixelFormatList?.Count == 0)
                    {
                        foreach (var item in Camera.PixelFormatTypeEnum)
                        {
                            PixelFormatList.Add(item);
                        }
                    }
                }

                //获取触发模式列表
                if (Camera.TriggerModeEnum != null)
                {
                    //设置列表
                    if (TriggerModeList?.Count == 0)
                    {
                        foreach (var item in Camera.TriggerModeEnum)
                        {
                            TriggerModeList.Add(item);
                        }
                    }
                }

                //获取触发源列表
                if (Camera.TriggerSourceEnum != null)
                {
                    //设置列表
                    if (TriggerSourceList?.Count == 0)
                    {
                        foreach (var item in Camera.TriggerSourceEnum)
                        {
                            TriggerSourceList.Add(item);
                        }
                    }
                }

                //获取硬件有效触发列表
                if (Camera.TriggerActivationEnum != null)
                {
                    //设置列表
                    if (TriggerActivationList?.Count == 0)
                    {
                        foreach (var item in Camera.TriggerActivationEnum)
                        {
                            TriggerActivationList.Add(item);
                        }
                    }
                }
            }
            else
            {
                PixelFormatList.Clear();
                TriggerModeList.Clear();
                TriggerSourceList.Clear();
                TriggerActivationList.Clear();
            }
        }