Пример #1
0
        public CalibratedThermalFrame ProcessFrame(ThermalFrame calibrationFrame)
        {
            UInt16[] output = new UInt16[Width * Height];

            for(int i=0;i<output.Length;i++)
            {
                int v = BitConverter.ToUInt16(RawData, i * 2);
                int c = BitConverter.ToUInt16(calibrationFrame.RawData, i * 2);

                if (v < 0x800)
                {
                    // Dead pixel, clamp it to zero.
                    v = 0;
                }
                else
                {
                    v = v - c + 0x8000;
                    if (v < 0) v = 0;
                    if (v > 0xFFFF) v = 0xFFFF;
                }
                output[i] = (UInt16)v;
           
            }
            return new CalibratedThermalFrame(output);
        }
Пример #2
0
        public CalibratedThermalFrame ProcessFrame(ThermalFrame calibrationFrame)
        {
            UInt16[] output = new UInt16[Width * Height];

            for (int i = 0; i < output.Length; i++)
            {
                int v = BitConverter.ToUInt16(RawData, i * 2);
                int c = BitConverter.ToUInt16(calibrationFrame.RawData, i * 2);

                if (v < 0x800)
                {
                    // Dead pixel, clamp it to zero.
                    v = 0;
                }
                else
                {
                    v = v - c + 0x8000;
                    if (v < 0)
                    {
                        v = 0;
                    }
                    if (v > 0xFFFF)
                    {
                        v = 0xFFFF;
                    }
                }
                output[i] = (UInt16)v;
            }
            return(new CalibratedThermalFrame(output));
        }
Пример #3
0
        void ThermalThreadProc()
        {
            while (!stopThread && thermal != null)
            {
                bool progress = false;
                lastFrame = thermal.GetFrameBlocking();

                if(lastFrame.IsCalibrationFrame)
                {
                    lastCalibrationFrame = lastFrame;
                }
                else
                {
                    if(lastCalibrationFrame != null && lastFrame.IsUsableFrame)
                    {
                        lastUsableFrame = lastFrame.ProcessFrame(lastCalibrationFrame);
                        progress = true;
                    }
                }


                //System.Diagnostics.Debug.Print("Start of data: " + string.Join(" ", lastFrame.RawData.Take(64).Select(b => b.ToString("x2")).ToArray()));
                //System.Diagnostics.Debug.Print("End of data: " + string.Join(" ", lastFrame.RawData.Reverse().Take(32).Reverse().Select(b => b.ToString("x2")).ToArray()));
                
                // Do stuff
                frameCount++;
                if(progress)
                {
                    Invalidate();
                }
            }
        }
Пример #4
0
 public CalibratedThermalFrame ProcessFrameU16(ThermalFrame calibrationFrame, ThermalFrame frameID4)
 {
     return(new CalibratedThermalFrame(RawDataU16));
 }