Пример #1
0
 public uint[] GetCalibrationFramePixels(uint frameNo)
 {
     if (frameNo < CalibrationSteamInfo.FrameCount)
     {
         uint[] pixels = AdvLib.GetFramePixels(1, (int)frameNo, Width, Height);
         return(pixels);
     }
     else
     {
         throw new AdvLibException(string.Format("Calibration frame number must be bwtween 0 and {0}", CalibrationSteamInfo.FrameCount - 1));
     }
 }
Пример #2
0
        public uint[] GetCalibrationFramePixels(uint frameNo, out AdvFrameInfo frameInfo)
        {
            if (frameNo < CalibrationSteamInfo.FrameCount)
            {
                uint[] pixels;
                int    errorCode = AdvLib.GetFramePixels(1, (int)frameNo, Width, Height, out frameInfo, out pixels);
                AdvError.Check(errorCode);
                foreach (var entry in StatusTagDefinitions)
                {
                    byte?  val8;
                    short? val16;
                    int?   val32;
                    long?  val64;
                    float? valf;
                    string vals;

                    switch (entry.Item3)
                    {
                    case Adv2TagType.Int8:
                        if (AdvLib.GetStatusTagUInt8(entry.Item2, out val8) == AdvError.S_OK && val8.HasValue)
                        {
                            frameInfo.Status.Add(entry.Item1, val8.Value);
                        }
                        break;

                    case Adv2TagType.Int16:
                        if (AdvLib.GetStatusTagInt16(entry.Item2, out val16) == AdvError.S_OK && val16.HasValue)
                        {
                            frameInfo.Status.Add(entry.Item1, val16.Value);
                        }
                        break;

                    case Adv2TagType.Int32:
                        if (AdvLib.GetStatusTagInt32(entry.Item2, out val32) == AdvError.S_OK && val32.HasValue)
                        {
                            frameInfo.Status.Add(entry.Item1, val32.Value);
                        }
                        break;

                    case Adv2TagType.Long64:
                        if (AdvLib.GetStatusTagInt64(entry.Item2, out val64) == AdvError.S_OK && val64.HasValue)
                        {
                            frameInfo.Status.Add(entry.Item1, val64.Value);
                        }
                        break;

                    case Adv2TagType.Real:
                        if (AdvLib.GetStatusTagFloat(entry.Item2, out valf) == AdvError.S_OK && valf.HasValue)
                        {
                            frameInfo.Status.Add(entry.Item1, valf.Value);
                        }
                        break;

                    case Adv2TagType.UTF8String:
                        if (AdvLib.GetStatusTagUTF8String(entry.Item2, out vals) == AdvError.S_OK)
                        {
                            frameInfo.Status.Add(entry.Item1, vals);
                        }
                        break;
                    }
                }
                return(pixels);
            }
            else
            {
                throw new AdvLibException(string.Format("Calibration frame number must be bwtween 0 and {0}", CalibrationSteamInfo.FrameCount - 1));
            }
        }