예제 #1
0
         public void ReadFPFImage(string fpfName)
        {
 
            if (File.Exists(fpfName))
            {
                BinaryReader reader = new BinaryReader(File.Open(fpfName, FileMode.Open));

                try
                {
                    // Read FPF header
                    header = new FPFHeader();
                    header.readFPFHeader(reader);

                    //Set image size
                    x_size = header.imgData.xSize;
                    y_size = header.imgData.ySize;

                    // Set image temperature range
                    range_tmin = header.camData.camera_range_tmin;
                    range_tmax = header.camData.camera_range_tmax;

                    // Read FPF image data 

                    if (header.imgData.ImageType != 0 || header.imgData.pixelFormat != 2)
                        //throw new Exception("Format not supported yet!");
                        return;

                    fpf_data = new float[x_size * y_size];
                    sat_list = new ArrayList();
                    data_tmin = float.MaxValue;
                    data_tmax = float.MinValue;
                    for (int i = 0; i < x_size * y_size; i++)
                    {
                        fpf_data[i] = reader.ReadSingle();
                        if (((int)fpf_data[i]) == 0) sat_list.Add(i); // saturated pixel!!
                        else if (fpf_data[i] < data_tmin) data_tmin = fpf_data[i];
                        else if (fpf_data[i] > data_tmax) data_tmax = fpf_data[i];
                    }    
                    if (sat_list.Count > 0)
                    {
                        data_tmax++;
                        foreach (int i in sat_list)
                        {
                            fpf_data[i] = data_tmax;
                        }
                    }
                }
                finally
                {
                    reader.Close();
                }
            }
        }
예제 #2
0
        public void ReadFPFImage(string fpfName)
        {
            if (File.Exists(fpfName))
            {
                BinaryReader reader = new BinaryReader(File.Open(fpfName, FileMode.Open));

                try
                {
                    // Read FPF header
                    header = new FPFHeader();
                    header.readFPFHeader(reader);

                    //Set image size
                    x_size = header.imgData.xSize;
                    y_size = header.imgData.ySize;

                    // Set image temperature range
                    range_tmin = header.camData.camera_range_tmin;
                    range_tmax = header.camData.camera_range_tmax;

                    // Read FPF image data

                    if (header.imgData.ImageType != 0 || header.imgData.pixelFormat != 2)
                    {
                        //throw new Exception("Format not supported yet!");
                        return;
                    }

                    fpf_data  = new float[x_size * y_size];
                    sat_list  = new ArrayList();
                    data_tmin = float.MaxValue;
                    data_tmax = float.MinValue;
                    for (int i = 0; i < x_size * y_size; i++)
                    {
                        fpf_data[i] = reader.ReadSingle();
                        if (((int)fpf_data[i]) == 0)
                        {
                            sat_list.Add(i);                          // saturated pixel!!
                        }
                        else if (fpf_data[i] < data_tmin)
                        {
                            data_tmin = fpf_data[i];
                        }
                        else if (fpf_data[i] > data_tmax)
                        {
                            data_tmax = fpf_data[i];
                        }
                    }
                    if (sat_list.Count > 0)
                    {
                        data_tmax++;
                        foreach (int i in sat_list)
                        {
                            fpf_data[i] = data_tmax;
                        }
                    }
                }
                finally
                {
                    reader.Close();
                }
            }
        }