Example #1
0
        public void ExportAsImage(string path, ImageFormat format)
        {
            var dirInfo = RecordingDirectory(path);

            dirInfo.Create();
            _logger.Info("Hex Imager File", String.Format("Exporting {0} images to - {1}", format.ToString(), dirInfo.FullName));

            ImageFile.EnterLock();
            try
            {
                int oldIndex = ImageFile.ThermalSequencePlayer.SelectedIndex;
                ImageFile.ThermalSequencePlayer.SelectedIndex = 0;

                ExportTotalCount    = ImageFile.Count() - 1;
                ExportCompleteCount = ImageFile.ThermalSequencePlayer.SelectedIndex;

                while (ExportCompleteCount < ExportTotalCount)
                {
                    var fileInfo = ImageFilename(dirInfo, format.ToString().ToLower(),
                                                 TimeSpan.FromSeconds((double)ImageFile.ThermalSequencePlayer.SelectedIndex / 10.0));

                    ImageFile.Image.Save(fileInfo.FullName, format);
                    ImageFile.ThermalSequencePlayer.Next();
                    ExportCompleteCount = ImageFile.ThermalSequencePlayer.SelectedIndex;
                }
                ImageFile.ThermalSequencePlayer.SelectedIndex = oldIndex;
            }
            finally
            {
                ImageFile.ExitLock();
            }
        }
Example #2
0
        public void ExportAsVideo(string path)
        {
            var fileInfo = VideoFilename(RecordingDirectory(path), "avi");

            fileInfo.Directory.Create();

            var writer = new VideoFileWriter();

            writer.Open(fileInfo.FullName, ImageFile.Width, ImageFile.Height, (int)ImageFile.ThermalSequencePlayer.FrameRate, VideoCodec.MPEG4);
            _logger.Info("FLIR Image File", String.Format("Exporting video to - {0}", fileInfo.FullName));

            ImageFile.EnterLock();
            try
            {
                int oldIndex = ImageFile.ThermalSequencePlayer.SelectedIndex;
                ImageFile.ThermalSequencePlayer.SelectedIndex = 0;

                ExportTotalCount    = ImageFile.Count() - 1;
                ExportCompleteCount = ImageFile.ThermalSequencePlayer.SelectedIndex;

                while (ExportCompleteCount < ExportTotalCount)
                {
                    writer.WriteVideoFrame(ImageFile.Image);
                    ImageFile.ThermalSequencePlayer.Next();
                    ExportCompleteCount = ImageFile.ThermalSequencePlayer.SelectedIndex;
                }

                writer.Close();
                ImageFile.ThermalSequencePlayer.SelectedIndex = oldIndex;
            }
            finally
            {
                ImageFile.ExitLock();
            }
        }
Example #3
0
        public void ExportAsCSV(string path)
        {
            var fileInfo = CsvFilename(RecordingDirectory(path), "csv");

            fileInfo.Directory.Create();

            using (var outfile = new StreamWriter(fileInfo.FullName, true))
            {
                _logger.Info("FLIR Image File", String.Format("Exporting CSV to - {0}", fileInfo.FullName));

                ImageFile.EnterLock();
                try
                {
                    int oldIndex = ImageFile.ThermalSequencePlayer.SelectedIndex;
                    ImageFile.ThermalSequencePlayer.SelectedIndex = 0;

                    ExportTotalCount    = ImageFile.Count() - 1;
                    ExportCompleteCount = ImageFile.ThermalSequencePlayer.SelectedIndex;

                    while (ExportCompleteCount < ExportTotalCount)
                    {
                        //outfile.Write(String.Format("Frame {0}", ExportCompleteCount));
                        //outfile.Write(Environment.NewLine);
                        var arr = ImageFile.ImageProcessing.GetPixelsArray();
                        for (int i = 0; i < arr.GetLength(1); i++)  //changed to 1 by Marcus
                        {
                            for (int j = 0; j < arr.GetLength(0); j++)
                            {
                                // Potentially needs to be scaled by ImageFile.MinSignalValue - ImageFile.MaxSignalValue
                                // var value = (arr[i, j] * (ImageFile.MaxSignalValue - ImageFile.MinSignalValue) / Int16.MaxValue) + ImageFile.MinSignalValue;
                                var value = ImageFile.GetValueAt(new Point(i, j)).Value;
                                outfile.Write(value.ToString() + ',');
                            }
                            outfile.Write(Environment.NewLine);
                        }
                        ImageFile.ThermalSequencePlayer.Next();
                        ExportCompleteCount = ImageFile.ThermalSequencePlayer.SelectedIndex;
                    }

                    ImageFile.ThermalSequencePlayer.SelectedIndex = oldIndex;
                }
                finally
                {
                    ImageFile.ExitLock();
                }
            }
        }