raw2temp {Thermimage} | R Documentation |
Converts raw thermal data into temperature (oC)
Description
Converts a raw value obtained from binary thermal image video file into estimated temperature using standard equations used in infrared thermography.
Usage
raw2temp(raw, E = 1, OD = 1, RTemp = 20, ATemp = RTemp, IRWTemp = RTemp, IRT = 1,
RH = 50, PR1 = 21106.77, PB = 1501, PF = 1, PO = -7340, PR2 = 0.012545258,
ATA1=0.006569, ATA2=0.01262, ATB1=-0.002276, ATB2=-0.00667, ATX=1.9)
Arguments
raw |
A/D bit signal from FLIR file. FLIR .seq files and .fcf files store data in a 16-bit encoded value. This means it can range from 0 up to 65535. This is referred to as the raw value. The raw value is actually what the sensor detects which is related to the radiance hitting the sensor. At the factory, each sensor has been calibrated against a blackbody radiation source so calibration values to conver the raw signal into the expected temperature of a blackbody radiator are provided. Since the sensors do not pick up all wavelengths of light, the calibration can be estimated usinga limited version of Planck's law. But the blackbody calibration is still critical to this. |
E |
Emissivity - default 1, should be ~0.95 to 0.97 depending on object of interest. Determined by user. |
OD |
Object distance from thermal camera in metres |
RTemp |
Apparent reflected temperature (oC) of the enrivonment impinging on the object of interest - one value from FLIR file (oC), default 20C. |
ATemp |
Atmospheric temperature (oC) for infrared tranmission loss - one value from FLIR file (oC) - default value is set to be equal to the reflected temperature. Transmission loss is a function of absolute humidity in the air. |
IRWTemp |
Infrared Window Temperature (oC). Default is set to be equivalent to reflected temp (oC). |
IRT |
Infrared Window transmission - default is set to 1.0. Likely ~0.95-0.97. Should be empirically determined. Germanium windows with anti-reflective coating typically have IRTs ~0.95-0.97. |
RH |
Relative humidity expressed as percent. Default value is 50. |
PR1 |
PlanckR1 - a calibration constant for FLIR cameras |
PB |
PlanckB - a calibration constant for FLIR cameras |
PF |
PlanckF - a calibration constant for FLIR cameras |
PO |
PlanckO - a calibration constant for FLIR cameras |
PR2 |
PlanckR2 - a calibration constant for FLIR cameras |
ATA1 |
ATA1 - an atmospheric attenuation constant to calculate atmospheric tau |
ATA2 |
ATA2 - an atmospheric attenuation constant to calculate atmospheric tau |
ATB1 |
ATB1 - an atmospheric attenuation constant to calculate atmospheric tau |
ATB2 |
ATB2 - an atmospheric attenuation constant to calculate atmospheric tau |
ATX |
ATX - an atmospheric attenuation constant to calculate atmospheric tau |
Details
Note: PR1, PR2, PB, PF, and PO are specific to each camera and result from the calibration at factory of the camera's Raw data signal recording from a blackbody radiation source. Sample calibration constants for three different cameras (FLIR SC660 with 24x18 degree lens, FLIR T300 with 25x19 degree lens, FLIR T300 with 2xtelephoto.
Calibration Constants by cameras: SC660, T300(25o), T300(25o with telephoto)
Constant | FLIR SC660 | FLIR T300 | FLIR T300(t) |
PR1: | 21106.77 | 14364.633 | 14906.216 |
PB: | 1501 | 1385.4 | 1396.5 |
PF: | 1 | 1 | 1 |
PO: | -7340 | -5753 | -7261 |
PR2: | 0.012545258 | 0.010603162 | 0.010956882 |
PR1: PlanckR1 calibration constant PB: PlanckB calibration constant PF: PlanckF calibration constant PO: PlanckO calibration constant PR2: PlanckR2 calibration constant
The calibration constants allow for the raw digital signal conversion to and from the predicted radiance of a blackbody, using the standard equation:
temperature<-PB/log(PR1/(PR2*(raw+PO))+PF)-273.15
Also used in calculations for transmission loss are the following constants:
ATA1: Atmospheric Trans Alpha 1 0.006569 ATA2: Atmospheric Trans Alpha 2 0.012620 ATB1: Atmospheric Trans Beta 1 -0.002276 ATB2: Atmospheric Trans Beta 2 -0.006670 ATX: Atmospheric Trans X 1.900000
Some files may return slightly different ATA1, ATA2, ATB1, ATB2, and ATX values. Use the flirsettings function to find out what constants are used for your files.
Value
Returns numeric value in degrees C. Can handle vector or matrix objects
Warning
Raw values need to be greater than Planck0 constant
Author(s)
Glenn J. Tattersall
References
1. http://130.15.24.88/exiftool/forum/index.php/topic,4898.60.html
2. Minkina, W. and Dudzik, S. 2009. Infrared Thermography: Errors and Uncertainties. Wiley Press, 192 pp.
See Also
Examples
# General Usage:
# raw2temp(raw,E,OD,RTemp,ATemp,IRWTemp,IRT,RH,PR1,PB,PF,PO,PR2,ATA1,ATA2,ATB1,ATB2,ATX)
#
# Example with all settings at default/blackbody levels:
raw2temp(18109,1,0,20,20,20,1,50,PR1=21106.77,PB=1501,PF=1,PO=-7340,PR2=0.012545258,
ATA1=0.006569, ATA2=0.01262, ATB1=-0.002276, ATB2=-0.00667, ATX=1.9)
# Example with emissivity=0.95, distance=1m, window transmission=0.96, all temperatures=20C,
# 50 RH:
raw2temp(18109,0.95,1,20,20,20,0.96,50)
# Note: default calibration constants for the FLIR camera will be used if you leave out the
# calibration data
# Vector example
r<-17000:25000
t1.0<-raw2temp(r,1,0,20,20,20,0.96,50)
t0.9<-raw2temp(r,0.9,0,20,20,20,0.96,50)
dev.off()
plot(r,t1.0,type="l",col="red")
lines(r,t0.9,col="black")
legend("topleft", bty = "n", c("E=1.0", "E=0.9"), lty=c(1,1), col=c("red", "black"))
# Create a templookup vector - faster calculations when working with huge binary data files
# suppressWarnings remove the NaN warning that results from the low values falling outside the
# range of temperatures relevant
suppressWarnings(templookup<-raw2temp(raw=1:65535))
r<-floor(runif(10000000, 16000,25000)) # create a long vector of raw binary values
# calculate temperature using the lookup vector:
system.time(templookup[r]) # 0.109 seconds
# calculate temperature using the raw2temp function on the raw vector:
system.time(raw2temp(r)) # 0.248 seconds
# For information on the effectiveness of the raw2temp and temp2raw
# functions at estimating temperature properly, see the following:
# https://github.com/gtatters/ThermimageCalibration