Exemplo n.º 1
0
        /// <summary>
        /// Accessor to false color coded palette image and thermal image from same frame
        /// </summary>
        /// <returns cref="ThermalPaletteImage">False color coded palette and thermal image</returns>
        /// <exception cref="System.Exception">Thrown on error</exception>
        public ThermalPaletteImage GetThermalPaletteImage()
        {
            CheckConnectionState();
            int paletteWidth, paletteHeight;
            int thermalWidth, thermalHeight;

            CheckResult(IrDirectInterfaceInvoke.evo_irimager_get_palette_image_size(out paletteWidth, out paletteHeight));
            CheckResult(IrDirectInterfaceInvoke.evo_irimager_get_thermal_image_size(out thermalWidth, out thermalHeight));

            Bitmap paletteImage = new Bitmap(paletteWidth, paletteHeight, PixelFormat.Format24bppRgb);

            ushort[,] thermalImage = new ushort[thermalHeight, thermalWidth];

            BitmapData bmpData = paletteImage.LockBits(new Rectangle(0, 0, paletteImage.Width, paletteImage.Height), ImageLockMode.WriteOnly, paletteImage.PixelFormat);

            CheckResult(IrDirectInterfaceInvoke.evo_irimager_get_thermal_palette_image(
                            thermalWidth, thermalHeight, thermalImage,
                            paletteImage.Width, paletteImage.Height, bmpData.Scan0));

            paletteImage.UnlockBits(bmpData);

            return(new ThermalPaletteImage(thermalImage, paletteImage));
        }